Commit Graph
367 Commits
Author SHA1 Message Date
Emmanuele Bassi 80f20ce62c cross: Tweak inclusion path for Fedora/mingw64
We should explicitly add the include directory under the mingw64
toolchain to the C arguments when cross-compiling, just like we add the
libdir to the link flags.
2017-01-31 12:59:46 +00:00
Emmanuele Bassi 2b2055576e Merge pull request #90 from nwnk/egl-get-current-context-api
egl: Fix the query for the current context's API
2017-01-30 13:02:55 +00:00
Emmanuele Bassi 09c7657370 Import registry from SVN 33390 2017-01-30 11:54:47 +00:00
Emmanuele Bassi 50272b7042 Merge pull request #99 from TingPing/meson-cleanup
build: Clean up some Meson usage
2017-01-28 12:22:35 +00:00
Nirbheek Chauhan d82bedc227 meson: Don't call find_program objects with python
On UNIX-like OSes, the OS will read the shebang and use the correct
interpreter, and on Windows, Meson will read the shebang and use the
correct interpreter.

Adding it manually will cause python to try to interpret python
2017-01-28 06:54:10 +05:30
Patrick Griffis 61dac912e6 build: Clean up some Meson usage 2017-01-27 19:13:48 -05:00
Emmanuele Bassi 7c902e3e2b docs: Update the README file
Use the appropriate Markdown syntax (with GitHub extensions) for code
blocks and preformatted bits, and update the build instructions and
dependencies for Meson and Ninja.
2017-01-25 14:51:04 +00:00
Emmanuele Bassi 7a06803465 Improve consistency of the symbol visibility
To avoid a symbols file on Windows, Epoxy annotates all the publicly
visible symbols directly in the source, but uses the default symbol
visibility everywhere else. This means that only some symbols are
annotated as `EPOXY_IMPORTEXPORT`, and generally only on Windows.
Additionally, Epoxy has a private 'PUBLIC' pre-processor macro for
internal use, which duplicates the `EPOXY_IMPORTEXPORT` but contains
more logic to detect GCC, in case we're building with GCC on Windows.

This would be enough, except that EGL is also available on Windows,
which means we'd have to annotate the exported `epoxy_*` API inside
epoxy/egl.h as well. At that point, though, we should probably avoid
any confusion, and adopt a single symbol visibility policy across the
board.

This requires some surgery of the generated and common dispatch sources,
but cuts down the overall complexity:

 - there is only one annotation, `EPOXY_PUBLIC`, used everywhere
 - the annotation detection is done at Epoxy configuration time
 - only annotated symbols are public, on every platform
 - annotated symbols are immediately visible from the header
2017-01-25 12:43:17 +00:00
Emmanuele Bassi 0625a74d69 Add common header
We're going to use this header to provide shared macros. Right now, we
can use it to replace the:

    #ifdef __cplusplus
    extern "C" {
    #endif

    …

    #ifdef __cplusplus
    }
    #endif

Stanzas for every installed header, with easier to read macros in the
same spirit of Cairo and GLib.
2017-01-25 12:43:17 +00:00
Emmanuele Bassi 41bea9e0fb build: Drop '-Wall' from the checked compiler arguments
Meson adds `-Wall` for us with `warning_level=1`.
2017-01-25 12:41:05 +00:00
Emmanuele Bassi ba2e7b151b build: Explicitly link against gdi32
We need to explicitly link against gdi32 in order to access
SetPixelFormat and ChoosetPixelFormat, and the order of the linking is
relevant when using static libraries. This is a slight workaround to the
order of compiler arguments generated by Meson, and it's supposed to go
away in the near future.
2017-01-25 12:41:02 +00:00
Emmanuele Bassi bbcc3b4b81 build: Add cross-compile definitions for Mingw64 on Fedora
Meson uses plain text files for describing the cross-compilation
environment, binaries, and properties.

The values are taken from the mingw wrapper around configure that
Fedora provides for autotools projects.
2017-01-25 12:37:45 +00:00
Emmanuele Bassi 59318edf64 build: Rework the build rules for generated files in Meson
Instead of using a generator and having to deal with tweaking the
inclusion paths, we can use a custom target rule, which will do the
right thing and put the generate files where we expect them to be.

Due to how Meson and Ninja work we need to be a bit more careful as to
how we deal with dependencies and generated files, especially since
Epoxy is built on the assumption that the only inclusion path for the
headers lies under the 'include' sub-directory.

First of all, we need to split the dispatch table generation into two
separate steps, one for the headers and one for the source files.

Additionally, we need to munge the paths of the non-generated headers
so that we reference them by their correct path.

These changes are necessary to ensure that Epoxy can be built on a
system without Epoxy installed already; the previous Meson-based build
system relied on the headers being installed in a system directory.
2017-01-25 12:36:20 +00:00
Emmanuele Bassi 08cc4d021d build: Add Meson build files
Meson is a Python-based build system that generates build rules of
Ninja, Visual Studio, and XCode. It's designed to be fast, and have a
small, non-Turing complete language to describe the build process,
tests, and dependencies. It's simpler than CMake, and faster than
autotools.

As a direct comparison in terms of speed, three build and check runs for
libepoxy from a clean Git repository clone yield these results on my
Kabylake Core i7 7500U (nproc=4):

- Autotools (make)
Run #1 (cold)   real: 22.384s, user: 20.011s, sys: 3.689s
Run #2 (warm)   real: 22.429s, user: 20.220s, sys: 3.708s
Run #3 (warm)   real: 22.068s, user: 19.743s, sys: 3.594s

- Meson (ninja)
Run #1 (cold)   real: 5.932s, user:  9.371s, sys: 1.625s
Run #2 (warm)   real: 6.273s, user: 10.066,  sys: 1.740s
Run #3 (warm)   real: 5.796s, user:  9.233s, sys: 1.607s

Which means that Meson and ninja are approximately 4x faster than
autotools.

In terms of simplicity, the autotools build takes six files and a total
of 645 lines; Meson requires 3 files, and 361 lines to achieve the same
result. Additionally, Meson automatically builds in a separate build
directory and does not leave files inside the source directory; and Meson
does not use libtool.

Since Meson is quite new and still actively developed, we're going to
leave the autotools build in place for a while, with the intention of
switching to Meson in the future.
2017-01-25 12:36:20 +00:00
Emmanuele Bassi e2e2fedbdb build: Split arguments for dispatch generator
The gen_dispatch.py script relies on the source and include directories
to exist before dumping the files in there, split by type, in order to
sustain the split of the headers existing in a separate root from the
source files. This causes a spooky-action-at-a-distance scenario where
headers are generated by rules inside the source directory but influence
the contents of a separate directory — and require a separate set of
rules to install those headers.

Different build systems would require either splitting the generation in
to two separate passes (which is more expensive and time consuming), or
generate the header and source files in the same directory, and just
tweak the inclusion paths accordingly.

Since we want to maintain this fiction for the autotools build, but
ignore it for different build systems, let's add a separate set of
arguments for gen_dispatch.py that make the rules inside Makefile.am
work appropriately.
2017-01-25 12:28:29 +00:00
Emmanuele Bassi 4fe238e023 tests/wgl: Use the right array offsets
And avoid an out of bounds access warning.
2017-01-25 12:28:29 +00:00
Chun-wei Fan 3a38371367 MSVC Builds: Support PACKED
Define PACKED for Visual Studio builds, so that we can try to reduce
our library size for Visual Studio builds.  Add a ENDPACKED macro
that is currently defined only for Visual Studio builds as packing is
done via __pragma(pack(push,n), that should be popped when done.

Signed-off-by: Emmanuele Bassi <[email protected]>
2017-01-25 12:28:29 +00:00
Emmanuele Bassi 6b68ddeaa0 build: Skip GLESv1 tests if there's no GLESv1
It's pretty much pointless to build and run tests for a library that we
know is not available.

The Meson build already skips the GLES 1.0 test, so let's make the
Autotools build do the same.
2017-01-25 12:28:29 +00:00
Adam Jackson 2aec628eb0 test: Fix dlwrap on ppc64 and s390x
These have dlsym versions of GLIBC_2.3 and GLIBC_2.2, respectively.

Signed-off-by: Adam Jackson <[email protected]>
2017-01-25 12:28:29 +00:00
Emmanuele Bassi 5b9ddf1291 build: Hide mkdir
We don't really need to mess the log when creating the include directory
in the build directory.
2017-01-25 12:28:29 +00:00
Emmanuele Bassi 0f7f16b732 build: Protect paths from spaces
Completes commit 83cfa6a1b5b665ec99f5bbd44650b4816ba8fef5.
2017-01-25 12:28:29 +00:00
Emmanuele Bassi a15a92c2cb Ensure we don't assert if GLX is not available
Certain X server do not have GLX enabled or supported, such as x2go. We
can handle this case gracefully inside libepoxy.

Signed-off-by: Emmanuele Bassi <[email protected]>
2017-01-25 12:28:29 +00:00
Emmanuele Bassi 5df022edb5 Do not call errx() on platforms without it
Like, say, Windows.
2017-01-25 12:22:57 +00:00
Emmanuele Bassi bac9400bb0 Use EGL to retrieve pointers if available
EGL is available on different platforms, so we should favor it, if
available. This also allows us to decouple EGL from GLX, and use the
former without the latter being compiled in.
2017-01-25 12:22:57 +00:00
Yaron Cohen-Tal 9e46b8e659 Use the appropriate GLES library name for Windows
Shared libraries on Windows use `.dll` for the extension, not `.so`.

Signed-off-by: Emmanuele Bassi <[email protected]>
2017-01-25 12:22:57 +00:00
Simon Parzer a937245efc add glBindRenderbufferEXT to half_aliases
it seems like this was forgotten,
because glBindFramebufferEXT is already there
for the same reason

Signed-off-by: Emmanuele Bassi <[email protected]>
2017-01-25 12:22:57 +00:00
Adam Jackson f5ce42e3fe egl: Be somewhat aware of EGL client extensions
Client extensions are always available, and are only listed in
eglQueryString(dpy=NULL). Without this we can't call anything from e.g.
EXT_platform_base.

Signed-off-by: Adam Jackson <[email protected]>
2017-01-18 14:29:04 +00:00
Martin Castillo 7e9e12f41d fixes 'cd error' in autogen.sh
If a parent directory of the libepoxy source dir contains a space,
'cd' in line 10 fails.
2017-01-18 14:29:04 +00:00
Adam Jackson 91916269e5 egl: Fix the query for the current context's API
Binding an API does not change the type of the current context. Even if
it did, EGL 1.5 treats EGL_OPENGL_API and EGL_OPENGLES_API as identical
for this purpose.  If you want to know properties of the current
context, query it.

Signed-off-by: Adam Jackson <[email protected]>
2017-01-18 14:29:04 +00:00
Emmanuele Bassi ad1f9204a2 Avoid C99 declaration after statement
The rest of the library is C89-only, so we should keep it that way.
2016-12-07 15:12:38 +00:00
Olivier Blin f62c9d92d0 dlwrap: add GLIBC_2.4 version to be able to run tests from ARM
See sysdeps/unix/sysv/linux/arm/libdl.abilist in glibc

Signed-off-by: Emmanuele Bassi <[email protected]>
2016-12-07 15:09:02 +00:00
Daniel Wolf c2e09ebde9 support newer/larger gl.xml
Signed-off-by: Emmanuele Bassi <[email protected]>
2016-12-07 15:03:53 +00:00
Yaron Cohen-Tal c45cc5f821 Check for NULL extensions string
Some X server not supporting any OpenGL feature, glXQueryExtensionsString
will return NULL and causes the function to fail.

Thanks to Emmanuel Stapf ([email protected]) for the original patch.

This was verified running an application on macOS while the X server was
running on Windows Xming 7.5.0.10

Signed-off-by: Emmanuele Bassi <[email protected]>
2016-12-07 15:00:40 +00:00
Bryan Kadzban f887dcf79b nVidia glx.h uses __glx_h__; define that too.
The code used to check this symbol, but commit 689abf4 replaced it with
GLX_H, presumably to work better with either Mesa or Khronos headers.
But nVidia's header use the older include guard. Add it as another
option.

Should fix the headerguards.c compile test when the system glx.h is from
nVidia's binary drivers.

Signed-off-by: Emmanuele Bassi <[email protected]>
2016-12-07 14:59:53 +00:00
Chun-wei Fan 407f579f2d src/gen_dispatch.py: Make Generated Code Build Under C89
...so that the generated code are buildable by pre-2013 Visual Studio.

 The main thing that this does is that we avoid named initializers, but
 instead initialize the structs in old-school C89 way.

 The generated code may not look that robust, but since this is generated
 code, I think this is not that much an issue; when the Khronos registry gets
 updated, all that is needed is that the code gets re-generated, and we have the
 items in the right order.

Signed-off-by: Emmanuele Bassi <[email protected]>
2016-12-07 14:53:44 +00:00
Emmanuele Bassi 8dead45cb3 Revert all changes since 8bbc0d40
Most of the changes that happened after commit 8bbc0d40 broke epoxy
pretty much irreparably because of the CMake build and the attempt at
making libepoxy a static library that can be copy-pasted into another
project without generating files.

Since all the commits are entangled, and are full of unrelated changes,
we cannot simply do a localized set of reverts; instead, we need to hit
the reset button.

From this point forward, we're going to improve libepoxy's build while
attempting to keep the existing build system working. This may mean
reinstating the CMake build system at a later date.
2016-12-07 14:45:14 +00:00
Yaron Cohen-Tal 0aa9d1bc83 Merge pull request #93 from ebassi/clean-autofoo-build
build: Drop autogenerated autotools files from Git
2016-11-08 09:52:59 +02:00
Yaron Cohen-Tal cc5e0157eb Merge pull request #92 from ebassi/force-rebuild
build: Force replacing autotools generated files
2016-11-08 09:51:40 +02:00
Emmanuele Bassi d5dfe2bd96 build: Drop autogenerated autotools files from Git
These files should not be under revision control.

This commit partially reverts:

  * 06fd4a271a
  * 62e384129b
2016-11-07 20:20:04 +00:00
Emmanuele Bassi 04387bc188 build: Force replacing autotools generated files
If the '--force' switch is not passed to autoreconf, the autotools will
try to reuse the generated files committed in the Git repo, which hard
code the names and versions of the tools originally used to generate
them.
2016-11-07 19:34:01 +00:00
Adam Jackson ced192c30b egl: Fix the query for the current context's API
Binding an API does not change the type of the current context. Even if
it did, EGL 1.5 treats EGL_OPENGL_API and EGL_OPENGLES_API as identical
for this purpose.  If you want to know properties of the current
context, query it.

Signed-off-by: Adam Jackson <[email protected]>
2016-10-18 11:11:52 -04:00
Yaron Cohen-Tal 15898325c1 Merge pull request #3 from RobotCaleb/patch-2
Update README.md
2016-10-08 11:17:58 +03:00
Caleb Anderson c8fb7dd27d Update README.md
Typo and code block fixes
2016-10-07 22:14:37 -06:00
Caleb Anderson 1814f06490 Update README.md
Fix nmake list
2016-09-29 01:21:44 -06:00
Yaron Cohen-Tal 594e2e082a Merge pull request #2 from BryanKadzban/master
nVidia glx.h uses __glx_h__; define that too.
2016-09-07 17:28:47 +03:00
Bryan Kadzban 58610268fe nVidia glx.h uses __glx_h__; define that too.
The code used to check this symbol, but commit 689abf4 replaced it with
GLX_H, presumably to work better with either Mesa or Khronos headers.
But nVidia's header use the older include guard. Add it as another
option.

Should fix the headerguards.c compile test when the system glx.h is from
nVidia's binary drivers.
2016-09-06 22:28:39 -07:00
Yaron Cohen-Tal b8d609e8f9 Fox some X server not supporting any OpenGL feature, glXQueryExtensionsString
will return NULL and causes the function to fail. Thanx to Emmanuel Stapf ([email protected]) for the original patch.

This was verified running an application on macOS while the X server was running
on Windows Xming 7.5.0.10
2016-07-29 17:55:49 +03:00
Yaron Cohen-Tal c342cba2a1 Add glibc versions 2.2 and 2.3 to "dlwrap_real_dlsym". 2015-11-05 17:51:01 +02:00
Yaron Cohen-Tal d81ab07f0b Update pregenerated files. 2015-11-03 10:12:50 +02:00
Yaron Cohen-Tal 6e3fa879cf Merge branch "oncer/half_aliases_fix". 2015-11-03 10:11:45 +02:00