Commit acf13330 authored by Dylan Baker's avatar Dylan Baker

Initial meson build system

This provides all of the capacities of the cmake build system except for
the find files (those are pretty complicated and specific to cmake), and
support for nacl. I don't have any way to test nacl (although there is
some code in the meson build to support it), and the nacl code we have
seems to be fairly out of date. I'm ready to merge this now and deal
with nacl later.

Done:
 - linux
 - tests
 - examples
 - docs
 - mac
 - install
 - use with piglit
 - windows

Todo:
 - nacl?
Reviewed-by: Eric Engestrom's avatarEric Engestrom <eric.engestrom@intel.com>
parent f842fe1d
...@@ -46,16 +46,18 @@ Waffle, see the following: ...@@ -46,16 +46,18 @@ Waffle, see the following:
# Build Requirements # Build Requirements
Waffle uses CMake for its build system. Waffle has two build systems, a mature cmake build system and an new meson
build system. We recommend using meson, but if you run into problems you may
want to try cmake.
## Linux ## Linux
On Linux it's recommended to install the cmake package using your On Linux it's recommended to install the cmake or meson package using your
distribution package manager. distribution package manager.
Archlinux: pacman -S cmake Archlinux: pacman -S cmake meson
Fedora 17: yum install cmake Fedora 17: yum install cmake meson
Debian: apt-get install cmake Debian: apt-get install cmake meson
To build the manpages or html documentation, xsltproc and the Docbook XSL To build the manpages or html documentation, xsltproc and the Docbook XSL
stylesheets are required. stylesheets are required.
...@@ -99,28 +101,32 @@ a comma-separated list of any combination of "x11", "wayland", and "drm". ...@@ -99,28 +101,32 @@ a comma-separated list of any combination of "x11", "wayland", and "drm".
### cross-building under Linux ### cross-building under Linux
Make sure that CMake is installed on your system. Make sure that CMake or meson is installed on your system.
Archlinux: pacman -S cmake Archlinux: pacman -S cmake meson
Fedora 17: yum install cmake Fedora 17: yum install cmake meson
Debian: apt-get install cmake Debian: apt-get install cmake meson
The MinGW-W64 cross-build toolchain is recommended and its CMake wrapper. The MinGW-W64 cross-build toolchain is recommended and its CMake wrapper.
Archlinux: pacman -S mingw-w64-gcc mingw-w64-cmake (latter is in AUR) Archlinux: aura -A mingw-w64-gcc mingw-w64-cmake (both are in the aur)
Fedora 17: yum install FINISHME Fedora 17: yum install FINISHME
Debian: apt-get install FINISHME Debian: apt-get install FINISHME
For meson you will need a mingw cross file.
### native builds ### native builds
Install Microsoft Visual Studio 2013 Update 4* or later.
Install 'Visual C++' feature.
### CMake
Download and install the latest version CMake from the official website: Download and install the latest version CMake from the official website:
http://cmake.org/ http://cmake.org/
Install Microsoft Visual Studio 2013 Update 4* or later.
Install 'Visual C++' feature.
Download OpenGL Core API and Extension Header Files. Download OpenGL Core API and Extension Header Files.
http://www.opengl.org/registry/#headers http://www.opengl.org/registry/#headers
...@@ -129,11 +135,18 @@ Copy the header files to MSVC. ...@@ -129,11 +135,18 @@ Copy the header files to MSVC.
C:\Program Files\Microsoft Visual Studio 12.0\VC\include\GL C:\Program Files\Microsoft Visual Studio 12.0\VC\include\GL
### Meson
Download and install the latest meson from github:
https://github.com/mesonbuild/meson/releases
OR, install python 3.x (currently 3.5 or later is supported) and install meson using pip:
py -3 -m pip install meson
There is no need to copy header files, meson uses a bundled copy
[*] Waffle heavily requires on features introduced by the C99 standard. As
such only reasonable compiler (at the time of writing) from the Microsoft
Visual Compiler series is MSVC 2013. Building with older versions is likely
to be broken.
### CYGWIN ### CYGWIN
Waffle is not tested to build under CYGWIN and is likely to be broken. Waffle is not tested to build under CYGWIN and is likely to be broken.
...@@ -168,7 +181,9 @@ a dependeny into /usr/local, then: ...@@ -168,7 +181,9 @@ a dependeny into /usr/local, then:
export PKG_CONFIG_PATH=/usr/local/share/pkgconfig:/usr/local/$libdir/pkgconfig:$PKG_CONFIG_PATH export PKG_CONFIG_PATH=/usr/local/share/pkgconfig:/usr/local/$libdir/pkgconfig:$PKG_CONFIG_PATH
### Configure CMake ## Building with CMake
### Configuring
#### Linux and Mac #### Linux and Mac
...@@ -307,3 +322,52 @@ it into a file called waffle1-VERSION-win32.zip. ...@@ -307,3 +322,52 @@ it into a file called waffle1-VERSION-win32.zip.
cd .\build\msvc32 cd .\build\msvc32
cmake --build . cmake --build .
cpack cpack
## Building with Meson
Once meson is installed you can configure the build with meson:
meson builddir
The default buildtype for waffle is `debugoptimzed`, which has debugging
symbols but is optimized. This is equivalent to the CMake builds `release`.
Meson's release mode does not have debugging symbols. If you wish to pass your
own flags via CFLAGS you should set buildtype to `plain`:
meson builddir -Dbuildtype=plain -Dc_args='-03 -march=native'
__NOTE__: meson only read CFLAGS (and CXXFLAGS, etc) at initial configuration
time. If you wish to change these flags you'll need to use the meson command
line option `-D${lang}_args=` (such as `-Dc_args=`). This can be used at
configure time as well. It is _highly_ recommended that you use -Dc_args
instead of CFLAGS.
You can check configuration options by:
meson configure builddir
Meson will be default try to find dependencies and enables targets that have
dependencies met. This behavior can be controlled using configure flags.
Meson detects compilers from the environment, rather from a toolchain file like
CMake does, the easiest way to set up MSVC is to launch a visual studio
terminal prompt, and run meson from there. Meson supports using both ninja (the
default) and msbuild on windows, to use msbuild add:
meson builddir -Dbackend=vs
On mac there is an xcode backend for meson, but it is not very mature and is
not recommended.
To cross compile pass the location of a cross file, as described
[here](http://mesonbuild.com/Cross-compilation.html).
If you want to build tests and don't have cmocka installed, meson will download
and build cmocka for you while building the rest of waffle. This works on
windows, but due to the way that .dll files work on windows it is only
supported if you add:
-Ddefault_library=static
Which will also build libwaffle as a static library.
# Copyright © 2018 Intel Corporation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
install_subdir('release-notes', install_dir : docdir)
# Copyright © 2018 Intel Corporation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
install_data(
'Makefile.example', 'gl_basic.c', 'simple-x11-egl.c',
install_dir : join_paths(docdir, 'examples'),
)
if build_x11_egl
executable(
'simple-x11-egl',
'simple-x11-egl.c',
dependencies : ext_waffle,
)
endif
# TODO: nacl
if build_cgl
# We need to force wflinfo.c to be compiled as if it were objc, to do that we
# copy it into the build directory as a .m file
files_gl_basic = configure_file(
input : 'gl_basic.c',
output : 'gl_basic.m',
copy : true,
)
else
files_gl_basic = files('gl_basic.c')
endif
executable(
'gl_basic',
files_gl_basic,
dependencies : [ext_waffle, dep_core_foundation, dep_cocoa, idep_getopt],
)
# Copyright (c) 2017 Dylan Baker
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
inc_include = include_directories('.')
inc_waffle = include_directories('waffle')
ver = meson.project_version().split('.')
data = configuration_data()
data.set('waffle_major_version', ver[0])
data.set('waffle_minor_version', ver[1])
data.set('waffle_patch_version', ver[2])
waffle_config_h = configure_file(
configuration : data,
input : 'waffle/waffle_version.h.in',
output : 'waffle_version.h',
)
install_headers(
'waffle/waffle.h',
'waffle/waffle_gbm.h',
'waffle/waffle_glx.h',
'waffle/waffle_wayland.h',
'waffle/waffle_x11_egl.h',
waffle_config_h,
subdir : waffle_name,
)
# Copyright © 2017 Intel Corporation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
split_version = meson.project_version().split('.')
conf_version = configuration_data()
conf_version.set('waffle_major_version', split_version[0])
conf_version.set('waffle_minor_version', split_version[1])
conf_version.set('waffle_patch_version', split_version[2])
waffle_version = configure_file(
input : 'waffle_version.h.in',
output : 'waffle_version.h',
configuration : conf_version,
)
install_headers(['waffle.h', 'waffle_gbm.h', 'waffle_gxl.h', 'waffle_wayland.h',
'waffle_x11_egl.h', waffle_version],
subdir : waffle_name)
# Copyright © 2018 Intel Corporation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
files_man_common = files(
'common/author-chad.versace.xml',
'common/copyright.xml',
'common/issues.xml',
'common/error-codes.xml',
'common/legalnotice.xml',
'common/return-value.xml',
)
# Each entry is a 4 part tuple consisting of
# <man section>, <name>, <extra pages that are <name>_<page>>, <extra_pages>
man_targets = [
['1', 'wflinfo', [], []],
['3', 'waffle_attrib_list', ['get', 'get_with_default', 'length', 'update'], []],
['3', 'waffle_config', ['choose', 'destroy', 'get_native'], []],
['3', 'waffle_context', ['create', 'destroy', 'get_native'], []],
['3', 'waffle_display', ['connect', 'disconnect', 'get_native', 'supports_context_api'], []],
['3', 'waffle_dl', ['can_open', 'sym'], []],
['3', 'waffle_enum', ['to_string'], []],
['3', 'waffle_error', ['get_code', 'get_info', 'to_string'], []],
['3', 'waffle_gbm', ['config', 'context', 'display', 'window'], []],
['3', 'waffle_get_proc_address', [], []],
['3', 'waffle_glx', ['config', 'context', 'display', 'window'], []],
['3', 'waffle_init', [], []],
['3', 'waffle_is_extension_in_string', [], []],
['3', 'waffle_make_current', [], ['waffle_get_current_display', 'waffle_get_current_window', 'waffle_get_current_context']],
['3', 'waffle_native', ['config', 'context', 'display', 'window'], []],
['3', 'waffle_teardown', [], []],
['3', 'waffle_wayland', ['config', 'context', 'display', 'window'], []],
['3', 'waffle_window', ['create', 'destroy', 'get_native', 'show', 'swap_buffers'], []],
['3', 'waffle_x11_egl', ['config', 'context', 'display', 'window'], []],
['7', 'waffle', [], []],
['7', 'waffle_feature_test_macros', [], []],
]
if get_option('build-manpages')
prog_xslt = find_program('xsltproc')
mans = []
foreach s : man_targets
extra_out = []
foreach e : s[2]
extra_out += '@0@_@1@.@2@'.format(s[1], e, s[0])
endforeach
foreach e : s[3]
extra_out += '@0@.@1@'.format(e, s[0])
endforeach
name = '@0@.@1@'.format(s[1], s[0])
mans += custom_target(
name,
input : ['manpage.xsl', name + '.xml'],
output : [name, extra_out],
command : [prog_xslt, '-nonet', '--xinclude', '-o', '@OUTPUT0@', '@INPUT@'],
depend_files : files_man_common,
)
endforeach
install_man(mans)
endif
if get_option('build-htmldocs')
prog_xslt = find_program('xsltproc')
foreach s : man_targets
extra_out = []
foreach e : s[2]
extra_out += '@0@_@1@.@2@'.format(s[1], e, s[0])
endforeach
foreach e : s[3]
extra_out += '@0@.@1@'.format(e, s[0])
endforeach
name = '@0@.@1@'.format(s[1], s[0])
custom_target(
name + '.html',
input : ['html.xsl', name + '.xml'],
output : [name + '.html'],
command : [prog_xslt, '-nonet', '--xinclude', '-o', '@OUTPUT0@', '@INPUT@'],
install : true,
install_dir : join_paths(docdir, 'html', 'man'),
depend_files : files_man_common,
)
endforeach
endif
# Copyright © 2017 Dylan Baker
# Copyright © 2018-2019 Intel Corporation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
project(
'waffle',
['c'],
version : '1.5.90',
license : 'BSD2',
meson_version : '>= 0.49',
default_options : ['c_std=c99', 'buildtype=debugoptimized'],
)
python = import('python').find_installation('python3')
waffle_name = meson.project_name() + '-1'
docdir = join_paths(get_option('datadir'), 'doc', meson.project_name() + '1')
build_x11_egl = false
build_wayland = false
build_glx = false
build_gbm = false
build_surfaceless = false
build_nacl = get_option('nacl')
build_wgl = ['windows', 'cygwin'].contains(host_machine.system())
build_cgl = host_machine.system() == 'darwin'
if build_nacl
add_languages('cpp')
endif
if build_cgl
add_languages('objc')
endif
cc = meson.get_compiler('c')
_dep_null = dependency('', required : false)
dep_threads = dependency('threads')
dep_dl = cc.find_library('dl', required : false)
dep_nacl = _dep_null
dep_gl = _dep_null
dep_egl = _dep_null
dep_wayland_client = _dep_null
dep_wayland_egl = _dep_null
dep_x11_xcb = _dep_null
dep_gbm = _dep_null
dep_udev = _dep_null
dep_cocoa = _dep_null
dep_core_foundation = _dep_null
dep_gl_headers = _dep_null
# Get dependencies
if build_wgl
if not cc.has_header('GL/wglext.h')
_sub = subproject('opengl_headers')
dep_gl_headers = _sub.get_variable('ext_headers')
endif
dep_gl = cc.find_library('opengl32')
elif build_cgl
# TODO: MacOS
dep_cocoa = dependency('cocoa')
dep_core_foundation = dependency('corefoundation')
dep_gl = dependency('gl')
else
dep_gl = dependency('gl', required : get_option('glx'))
dep_egl = dependency('egl', required : get_option('x11_egl'))
dep_wayland_client = dependency(
'wayland-client', version : '>= 1.0', required : get_option('wayland'),
)
dep_wayland_egl = dependency(
'wayland-egl', version : '>= 9.1', required : get_option('wayland'),
)
dep_x11_xcb = dependency('x11-xcb', required : get_option('glx'))
if not dep_x11_xcb.found()
dep_x11_xcb = dependency('x11-xcb', required : get_option('x11_egl'))
endif
dep_gbm = dependency('gbm', required : get_option('gbm'))
dep_udev = dependency('libudev', required : false)
build_x11_egl = dep_egl.found()
build_wayland = dep_wayland_client.found() and dep_wayland_egl.found()
build_glx = dep_gl.found()
build_gbm = dep_gbm.found()
build_surfaceless = dep_egl.found()
endif
dep_bash = dependency('bash-completion', required : false)
if dep_bash.found()
install_data(
'shell-completion/bash/wflinfo',
install_dir : dep_bash.get_pkgconfig_variable(
'completionsdir',
define_variable : ['prefix', get_option('prefix')]),
)
endif
# Set pre-processor flags
if build_wgl
add_project_arguments('-DWAFFLE_HAS_WGL', language : ['c', 'cpp'])
elif build_cgl
add_project_arguments('-DWAFFLE_HAS_CGL', language : ['c', 'obj'])
else
if build_x11_egl
add_project_arguments('-DWAFFLE_HAS_X11_EGL', language : ['c', 'cpp'])
endif
if build_glx
add_project_arguments('-DWAFFLE_HAS_GLX', language : ['c', 'cpp'])
endif
if build_wayland
add_project_arguments('-DWAFFLE_HAS_WAYLAND', language : ['c', 'cpp'])
endif
if build_gbm
add_project_arguments('-DWAFFLE_HAS_GBM', language : ['c', 'cpp'])
endif
if build_surfaceless
add_project_arguments('-DWAFFLE_HAS_SURFACELESS_EGL', language : ['c', 'cpp'])
endif
endif
if build_nacl
add_project_arguments('-DWAFFLE_HAS_NACL', language : ['c', 'cpp'])
endif
if cc.get_argument_syntax() == 'gcc'
if cc.compiles('''
static __thread int x;
int main() {
x = 42;
return x;
}''',
args : '-Werror',
name : 'Thread Local Storage')
add_project_arguments('-DWAFFLE_HAS_TLS', language : ['c', 'cpp'])
if cc.compiles('''
static __thread int x __attribute__((tls_model("initial-exec")));
int main() {
x = 42;
return x;
}''',
args : '-Werror',
name : 'TLS model "Initial Exec"')
add_project_arguments('-DWAFFLE_HAS_TLS_MODEL_INITIAL_EXEC', language : ['c', 'cpp'])
endif
endif
add_project_arguments('-D_XOPEN_SOURCE=700', language : ['c', 'cpp'])
if not build_nacl
add_project_arguments(
cc.get_supported_arguments([
'-Werror=implicit-function-declaration',
]),
language : ['c', 'cpp'],
)
endif
add_project_arguments(
cc.get_supported_arguments([
'-Werror=incompatible-pointer-types',
'-Werror=int-conversion',
'-Werror=missing-prototypes', # TODO: breaks on MacOS?
]),
language : ['c', 'cpp'],
)
if host_machine.system() == 'windows'
if cc.has_argument('-static-libgcc')
add_project_link_arguments('-static-libgcc', language : ['c', 'cpp'])
endif
endif
if cc.get_argument_syntax() == 'msvc'
add_project_arguments(
'/D_win32_WINNT=0x0601',
'/DWINVER=0x0601',
'/D_CRT_NONSTDC_NO_WARNINGS',
'/D_CRT_SECURE_NO_WARNINGS',
language : ['c'],
)
endif
if build_nacl
add_project_arguments('-DWAFFLE_HAS_NACL', language : ['c', 'cpp'])
endif
install_data('README.md', 'LICENSE.txt', 'HACKING.txt', install_dir : docdir)
install_subdir('doc/release-notes', install_dir : docdir)
api_c_args = [
'-DWAFFLE_API_VERSION=@0@'.format('0x0106'),
'-DWAFFLE_API_EXPERIMENTAL',
]
if get_option('build-tests')
dep_cmocka = dependency('cmocka', fallback : ['cmocka', 'dep_cmocka'])
else
dep_cmocka = _dep_null
endif
subdir('include')
subdir('third_party')
subdir('src')
subdir('doc')
subdir('man')
if get_option('build-tests')
subdir('tests')
endif
if get_option('build-examples')
subdir('examples')
endif
# TODO: CMake config file
# Copyright © 2017 Dylan Baker
# Copyright © 2018 Intel Corporation
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Options specifically for Non-macOS *nix systems below
option(
'glx',
type : 'feature',
description : 'Build support for GLX (only for *nix)'
)
option(
'wayland',
type : 'feature',
description : 'Build support for wayland (only for *nix)'
)
option(
'x11_egl',
type : 'feature',
description : 'Build support for X11/EGL (only for *nix)'
)
option(
'gbm',
type : 'feature',
description : 'Build support for GBM (only for mesa)'
)
option(
'surfaceless_egl',
type : 'feature',
description : 'Build support for EGL_MESA_platform_surfaceless'
)
# Options specifically for ChromeOS
option(
'nacl',
type : 'boolean',
value : false,
description : 'Build support for ChromeOS NaCl'
)
option(
'nacl_sdk_path',
type : 'string',
description : 'Path for NaCl SDK')
option(
'nacl_version',
type : 'string',
value : 'pepper_39',
description : 'Version of NaCL'
)
# Misc Options
option(
'build-tests',
type : 'boolean',
value : false,
description : 'Build tests'
)
option(
'build-manpages',
type : 'boolean',
value : false,
description : 'Build manpages'
)
option(
'build-htmldocs',
type : 'boolean',
value : false,
description : 'Build html documentation'
)
option(
'build-examples',
type : 'boolean',