build,ci: Build system maintenance (#350)

Squashed commit of the following:

commit 9ab0197ee1
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 28 23:05:58 2022 +0100

    build: add dummy descriptions for deprecated options

commit b0c41d4719
Author: Alice D <alice@starwitch.productions>
Date:   Mon Dec 26 15:18:09 2022 -0500

    update docker containers with ones containing meson 0.63.3

commit a2dd4173fc
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sun Dec 25 19:20:44 2022 +0100

    build: featurize audio options

commit 7c59e2a569
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sun Dec 25 19:20:35 2022 +0100

    build: remove dead code

commit cf500af137
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sun Dec 25 19:07:37 2022 +0100

    doc: update BUILD.rst

commit 9764ac706f
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sun Dec 25 17:12:37 2022 +0100

    ci: disable WGI joystick backend for SDL

    Fails to build with latest llvm-mingw

commit 2d4f310b90
Author: p-sam <p-sam@d3vs.net>
Date:   Sun Dec 25 17:03:47 2022 +0100

    switch: fix missing include

commit 9264f1649d
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sat Dec 24 14:36:41 2022 +0100

    ci: update meson to 0.63.3 due to a bug

commit 3e37be3d8f
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sat Dec 24 13:42:34 2022 +0100

    ci: update build options

commit 281a39a4f5
Author: Alice D <alice@starwitch.productions>
Date:   Sun Dec 18 00:17:07 2022 -0500

    ci: change when apt is cleaned up for switch image

commit 2f2100a84c
Author: Alice D <alice@starwitch.productions>
Date:   Sun Dec 18 00:11:08 2022 -0500

    ci: bump switch homebrew container version

commit ebaff59260
Author: Alice D <alice@starwitch.productions>
Date:   Sat Dec 17 22:55:39 2022 -0500

    ci: bump windows container version

commit 7ce6f23419
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sat Dec 17 07:36:28 2022 +0100

    build: featurize renderer options

commit a345f21b35
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sat Dec 17 07:33:30 2022 +0100

    build: revert to explicit fallback for libzstd

    Implicit fallback causes conflicts in the basis_universal subproject

    https://github.com/mesonbuild/meson/issues/11189

commit b2de61f5c5
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Sat Dec 17 05:29:29 2022 +0100

    build: remove debug_opengl

    This option was always misdocumented, as it only controlled whether GL
    debugging is on by default. You can still control it with the
    TAISEI_GL_DEBUG environment variable, which is set to 1 in meson devenv.

commit 4c659ba195
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Fri Dec 16 08:03:37 2022 +0100

    build: set up useful env vars for meson devenv

    Makes Taisei load resources from the source tree, making live reload
    work; enables OpenGL debugging by default; works around ASan stack use
    after return false positives.

commit 1ddc58b84a
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 08:06:32 2022 +0100

    build: featurize docs; always install licenses

commit c3a94d7f5b
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 07:46:28 2022 +0100

    build: featurize shader_transpiler

commit 619d82ae36
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 07:38:30 2022 +0100

    build: allow libzip fallback by default

commit 79ab72292a
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 07:35:51 2022 +0100

    build: featurize use_libcrypto

commit b393077f71
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 05:03:20 2022 +0100

    build: featurize validate_glsl

commit 7d76484079
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 04:34:31 2022 +0100

    build: featurize some more installation options

commit 17c0bda205
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 03:24:46 2022 +0100

    build: deprecate enable_zip for vfs_zip; convert package_data into feature

commit 9a4ef8c091
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 02:37:55 2022 +0100

    build: deprecate developer=auto; default to false

commit 807240e508
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 02:24:04 2022 +0100

    build: move subproject fallback info into wraps

commit 08c953f487
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 01:57:33 2022 +0100

    build: deprecate 'static' option

    Meson has a built-in `prefer_static` now

commit c575601537
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 01:49:31 2022 +0100

    build: remove complicated shaderc detection logic

    Meson does all of this internally since 0.51.0

commit cd2d460d4b
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Wed Dec 14 01:45:17 2022 +0100

    build: Require meson >=0.63.0

commit 10abd790f7
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Mon Dec 12 05:16:47 2022 +0100

    ci: remove meson dist version workaround from release workflow

    Meson should know the correct version now

commit 31a07d8c3c
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Mon Dec 12 03:46:28 2022 +0100

    build: use built-in summary() function

commit 0c47f6d14b
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Mon Dec 12 04:33:01 2022 +0100

    build: remove -Dversion_fallback and introduce .VERSION file

    The version script will now first try to read the version from a
    .VERSION file in the source root. If that file does not exist, it will
    query git. The .VERSION file is not included in the git repository, it
    is generated for inclusion in source tarballs.

    Package maintainers who had any use for -Dversion_fallback may want to
    create the .VERSION file themselves.

    Additionally, some git-specific files have been removed from source
    tarballs.

commit d32332a5e3
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Mon Dec 12 03:00:07 2022 +0100

    build: set the "real" version in project()

commit f9a3fbc729
Author: Andrei Alexeyev <akari@taisei-project.org>
Date:   Mon Dec 12 01:50:08 2022 +0100

    build: raise meson_version and remove some legacy workarounds

    Effectively 0.56.0 was already required since we started using some of
    its features at some point.

    This also fixes all current meson warnings.
This commit is contained in:
Andrei Alexeyev 2022-12-28 23:15:55 +01:00
parent 4cf14eeb3d
commit 267f47fc0e
No known key found for this signature in database
GPG key ID: 72D26128040B9690
52 changed files with 685 additions and 575 deletions

View file

@ -11,7 +11,7 @@ on:
- cron: '0 10 * * 4'
env:
MESON_VERSION: '0.56.2'
MESON_VERSION: '0.63.3'
EM_VERSION: 'tot'
EM_CACHE_FOLDER: 'emsdk'
@ -66,6 +66,7 @@ jobs:
source ${{ env.EM_CACHE_FOLDER }}/emsdk_env.sh
meson setup build/
--cross-file misc/ci/common-options.ini
--cross-file misc/ci/emscripten-ephemeral-ci.ini
--cross-file misc/ci/emscripten-build.ini
--prefix=$(pwd)/build-test

View file

@ -23,7 +23,7 @@ on:
- "**.wrap"
env:
MESON_VERSION: '0.56.2'
MESON_VERSION: '0.63.3'
EM_VERSION: '3.1.5'
EM_CACHE_FOLDER: 'emsdk'
TAISEI_NOPRELOAD: 0
@ -72,6 +72,7 @@ jobs:
- name: Configure
run: >
meson setup build/
--native-file misc/ci/common-options.ini
--native-file misc/ci/linux-x86_64-build-test-ci.ini
--prefix=$(pwd)/build-test
@ -132,6 +133,7 @@ jobs:
- name: Configure
run: >
meson setup build/
--native-file misc/ci/common-options.ini
--native-file misc/ci/macos-x86_64-build-test-ci.ini
--prefix=$(pwd)/build-test
@ -158,7 +160,7 @@ jobs:
name: Windows (x64)
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-20.04
container: taiseiproject/windows-toolkit:20220221 # cross-compiler with mingw
container: taiseiproject/windows-toolkit:20221226 # cross-compiler with mingw
steps:
- name: Checkout Code
uses: actions/checkout@v3
@ -168,6 +170,7 @@ jobs:
- name: Configure Taisei (Meson)
run: >
meson setup build/
--cross-file misc/ci/common-options.ini
--cross-file misc/ci/windows-llvm_mingw-x86_64-build-test-ci.ini
--prefix=$(pwd)/build-test
@ -243,6 +246,7 @@ jobs:
source ${{ env.EM_CACHE_FOLDER }}/emsdk_env.sh
meson setup build/
--cross-file misc/ci/common-options.ini
--cross-file misc/ci/emscripten-ephemeral-ci.ini
--cross-file misc/ci/emscripten-build.ini
--prefix=$(pwd)/build-test
@ -268,7 +272,7 @@ jobs:
name: Switch (ARM64)
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-20.04
container: taiseiproject/switch-toolkit:20210530
container: taiseiproject/switch-toolkit:20221226
steps:
- name: Checkout Code
uses: actions/checkout@v3
@ -280,7 +284,9 @@ jobs:
switch/crossfile.sh > misc/ci/switch-crossfile-ci.ini
meson setup build/
--cross-file=misc/ci/switch-crossfile-ci.ini
--cross-file misc/ci/common-options.ini
--cross-file misc/ci/switch-options.ini
--cross-file misc/ci/switch-crossfile-ci.ini
--prefix=$(pwd)/build-test
- name: Build

View file

@ -13,7 +13,7 @@ on:
description: "Input git-ref to build as a test release"
env:
MESON_VERSION: '0.56.2'
MESON_VERSION: '0.63.3'
EM_VERSION: '2.0.29'
EM_CACHE_FOLDER: 'emsdk'
TAISEI_NOPRELOAD: 0
@ -74,6 +74,7 @@ jobs:
git fetch --force --tags # see: https://github.com/actions/checkout/issues/290
meson setup build/linux
--native-file misc/ci/common-options.ini
--native-file misc/ci/linux-x86_64-build-release.ini
--prefix=$(pwd)/build-release
@ -112,8 +113,6 @@ jobs:
- name: Package (Source)
run: |
meson rewrite kwargs set project / version ${{ env.BUILD_VERSION }} # meson dist uses 'project.version' instead of 'git describe' for the tag to use, so this overwrites it as a workaround
meson --reconfigure build/linux
meson dist -C build/linux --no-tests # disable test build, since we already know it compiles
scripts/sign-release.py build/linux/meson-dist/taisei-${{ env.BUILD_VERSION }}.tar.xz
@ -212,7 +211,7 @@ jobs:
windows-release-build-x64:
name: Windows (x64)
runs-on: ubuntu-20.04
container: taiseiproject/windows-toolkit:20220221
container: taiseiproject/windows-toolkit:20221226
steps:
- name: Import GPG Key
uses: taisei-project/ghaction-import-gpg@v5
@ -240,6 +239,7 @@ jobs:
meson setup build/windows
-Dangle_libegl=$(pwd)/angle-compiled/lib/Windows-x64-dll/libEGL.dll
-Dangle_libgles=$(pwd)/angle-compiled/lib/Windows-x64-dll/libGLESv2.dll
--cross-file misc/ci/common-options.ini
--cross-file misc/ci/windows-llvm_mingw-x86_64-build-release.ini
--prefix=$(pwd)/build-release
@ -290,7 +290,7 @@ jobs:
windows-release-build-x86:
name: Windows (x86)
runs-on: ubuntu-20.04
container: taiseiproject/windows-toolkit:20220221
container: taiseiproject/windows-toolkit:20221226
steps:
- name: Import GPG Key
uses: taisei-project/ghaction-import-gpg@v5
@ -318,6 +318,7 @@ jobs:
meson setup build/windows
-Dangle_libegl=$(pwd)/angle-compiled/lib/Windows-x86-dll/libEGL.dll
-Dangle_libgles=$(pwd)/angle-compiled/lib/Windows-x86-dll/libGLESv2.dll
--cross-file misc/ci/common-options.ini
--cross-file misc/ci/windows-llvm_mingw-x86-build-release.ini
--prefix=$(pwd)/build-release
@ -434,6 +435,7 @@ jobs:
source ${{ env.EM_CACHE_FOLDER }}/emsdk_env.sh
meson setup build/emscripten
--cross-file misc/ci/common-options.ini
--cross-file misc/ci/emscripten-build.ini
--cross-file misc/ci/emscripten-ephemeral-ci.ini
--prefix=$(pwd)/build-release
@ -474,7 +476,7 @@ jobs:
switch-release-build:
name: Switch (ARM64)
runs-on: ubuntu-20.04
container: taiseiproject/switch-toolkit:20210829
container: taiseiproject/switch-toolkit:20221226
steps:
- name: Import GPG Key
uses: taisei-project/ghaction-import-gpg@v5
@ -496,7 +498,9 @@ jobs:
switch/crossfile.sh > misc/ci/switch-crossfile-ci.ini
meson setup build/nx
--cross-file=misc/ci/switch-crossfile-ci.ini
--cross-file misc/ci/common-options.ini
--cross-file misc/ci/switch-options.ini
--cross-file misc/ci/switch-crossfile-ci.ini
--prefix=$(pwd)/build-release
- name: Set Package Version

1
.gitignore vendored
View file

@ -14,3 +14,4 @@ __pycache__
*~
*-autosave.kra
*.swp
.VERSION

View file

@ -33,8 +33,8 @@ Build-Time Dependenices
"""""""""""""""""""""""
- ``gcc`` or ``clang``
- meson >= 0.53.0 (0.56.2 recommended)
- Python >= 3.6
- meson >= 0.63.0
- Python >= 3.7
- `python-zstandard <https://github.com/indygreg/python-zstandard>`__ >= 0.11.1
- `python-docutils <https://pypi.org/project/docutils/>`__ (optional, for generating documentation)
@ -45,7 +45,7 @@ Required
''''''''
- OpenGL >= 3.3, or OpenGL ES >= 3.0
- SDL2 >= 2.0.10
- SDL2 >= 2.0.16
- cglm >= 0.7.8
- libpng >= 1.5.0
- libwebpdecoder >= 0.5 or libwebp >= 0.5
@ -237,32 +237,39 @@ instead relying on system libraries. Useful for CI.
# disables in-repo repositories
meson configure build/ --wrap-mode=nofallback
Relative Directory Install (``-Dinstall_relative``)
Relative Directory Install (``-Dinstall_relocatable``)
"""""""""""""""""""""""""""""""""""""""""""""""""""
* Default: ``true`` or ``false`` (platform-dependent)
* Default: ``auto``
* Options: ``auto``, ``enabled``, ``disabled``
``-Dinstall_relative`` is a special option that changes depending on the
platform build target.
This option enables a "relocatable" installation layout, where everything is confined
to one directory and no full paths are hardcoded into the executable.
It is set to ``true`` when building for macOS, Windows, Emscripten, and Switch.
The ``auto`` defaults to ``enabled`` when building for Windows, Emscripten, Switch,
or macOS with ``install_macos_bundle`` enabled. Otherwise, it defaults to ``disabled``.
It is set to ``false`` when building for Linux.
Note that you probably want to change the ``--prefix`` with this option enabled.
.. code:: sh
meson configure build/ -Dinstall_relocatable=enabled
Install Prefix (``--prefix``)
"""""""""""""""""""""""""""""
* Default: ``/usr/local``
* Default: ``/usr/local`` (usually; platform-dependent)
``--prefix`` installs the Taisei binary and content files to a path of your
choice on your filesystem.
Specifies a path under which all game files are installed.
On Linux without ``-Dinstall_relative`` enabled (i.e: ``false``), it should be
kept to its default ``/usr/local``. In general, don't touch it unless you need
to.
If ``install_relocatable`` is enabled, Taisei will be installed into the root of this
directory, and thus you will probably want to change it from the default value.
On other platforms, it will install all Taisei game files to the directory of
your choice.
Otherwise, it's not recommended to touch this option unless you know what you are
doing.
This is a Meson built-in option; see `Meson Manual <https://mesonbuild.com/Builtin-options.html>`__
for more information.
.. code:: sh
@ -272,29 +279,31 @@ Package Data (``-Dpackage_data``)
"""""""""""""""""""""""""""""""""
* Default: ``auto``
* Options: ``auto``, ``true``, ``false``
* Options: ``auto``, ``enabled``, ``disabled``
Packages game data into either a directory or a ``.zip`` depending on if
``-Denable_zip`` is ``true`` (see below).
If enabled, game assets will be packaged into a ``.zip`` archive. Otherwise, they will
be installed into the filesystem directly.
This option is not available for Emscripten.
Requires ``vfs_zip`` to be enabled as well.
.. code:: sh
meson configure build/ -Dpackage_data=false
meson configure build/ -Dpackage_data=disabled
Enable ZIP Loading (``-Denable_zip``)
ZIP Package Loading (``-Dvfs_zip``)
"""""""""""""""""""""""""""""""""""""
* Default: ``true```
* Options: ``true``, ``false``
* Default: ``auto```
* Options: ``auto``, ``enabled``, ``disabled``
Controls whether or not Taisei can load game data (textures, shaders, etc) from
``.zip`` files. Useful for distribution and packaging.
**NOTE:** Setting this to ``false`` automatically disables ``-Dpackage_data``.
``.zip`` files. Requires ``libzip``.
.. code:: sh
meson configure build/ -Denable_zip=false
meson configure build/ -Dvfs_zip=disabled
In-Game Developer Options (``-Ddeveloper``)
"""""""""""""""""""""""""""""""""""""""""""
@ -302,9 +311,8 @@ In-Game Developer Options (``-Ddeveloper``)
* Default: ``false``
* Options: ``true``, ``false``
For testing actual gameplay, you can set this option and it will enable cheats
and other 'fast-forward' options by the pressing keys defined in
``src/config.h``.
Enables various tools useful for developers and testers, such as cheats, stage menu,
quick save/load, extra debugging information, etc.
.. code:: sh
@ -314,10 +322,12 @@ Build Type (``-Dbuildtype``)
""""""""""""""""""""""""""""
* Default: ``release``
* Options: ``release``, ``debug``
* Options: ``plain``, ``debug``, ``debugoptimized``, ``release``, ``minsize``, ``custom``
Sets the type of build. ``debug`` enables several additional debugging features,
as well as reduced optimizations and more debugging symbols.
Sets the type of build. ``debug`` reduces optimizations and enables debugging symbols.
This is a Meson built-in option; see `Meson Manual <https://mesonbuild.com/Builtin-options.html>`__
for more information.
.. code:: sh
@ -326,8 +336,8 @@ as well as reduced optimizations and more debugging symbols.
Assertions (``-Db_ndebug``)
"""""""""""""""""""""""""""
* Default: ``true``
* Options: ``true``, ``false``
* Default: ``if-release``
* Options: ``if-release``, ``true``, ``false``
The name of this flag is opposite of what you'd expect. Think of it as "Not
Debugging". It controls the ``NDEBUG`` declaration which is responsible for
@ -337,6 +347,9 @@ Setting to ``false`` will *enable* assertions (i.e: good for debugging).
Keep ``true`` during release.
This is a Meson built-in option; see `Meson Manual <https://mesonbuild.com/Builtin-options.html>`__
for more information.
.. code:: sh
meson configure build/ -Db_ndebug=false
@ -355,6 +368,9 @@ for the engine. Sometimes, it's overly-pedantic, but much of the time, it
provides useful advice. (For example, it can detect potential null-pointer
exceptions that may not be obvious to the human eye.)
This is a Meson built-in option; see `Meson Manual <https://mesonbuild.com/Builtin-options.html>`__
for more information.
.. code:: sh
meson configure build/ -Dwerror=true
@ -400,6 +416,9 @@ is correct by browsing to the parent directory of ``../clang``.
Then, you can launch Taisei's binary from the command line (using macOS as an
example):
This is a Meson built-in option; see `Meson Manual <https://mesonbuild.com/Builtin-options.html>`__
for more information.
.. code:: sh
/path/to/Taisei.app/Contents/MacOS/Taisei
@ -418,6 +437,9 @@ For release builds, this should be kept ``true``.
See: `Interprocedural Optimization <https://en.wikipedia.org/wiki/Interprocedural_optimization#WPO_and_LTO>`__
This is a Meson built-in option; see `Meson Manual <https://mesonbuild.com/Builtin-options.html>`__
for more information.
.. code:: sh
meson configure build/ -Db_lto=false
@ -441,11 +463,11 @@ strip out useful debugging symbols.
Rendering
"""""""""
Backends (``-Dr_gl*``)
Backends (``-Dr_*``)
''''''''''''''''''''''
* Default: ``false``
* Options: ``true``, ``false``
* Default: ``auto``
* Options: ``auto``, ``enabled``, ``disabled``
Enable or disable the various renderer backends for Taisei.
@ -454,11 +476,14 @@ Enable or disable the various renderer backends for Taisei.
.. code:: sh
# for GL 3.3 (default)
meson configure build/ -Dr_gl33=true
meson configure build/ -Dr_gl33=enabled
# for GL ES 3.0
meson configure build/ -Dr_gles30=true
meson configure build/ -Dr_gles30=enabled
# for GL ES 2.0 (not recommended)
meson configure build/ -Dr_gles20=true
meson configure build/ -Dr_gles20=enabled
# No-op backend (nothing displayed).
# Disabling this will break the replay-verification mode.
meson configure build/ -Dr_null=enabled
**NOTE:** GL ES 2.0 is *not recommended* as it is unsupported and may
not work correctly. However, if for some reason you still want to use it,
@ -475,11 +500,16 @@ correctly, most notably:
Default Renderer (``-Dr_default``)
''''''''''''''''''''''''''''''''''
* Default: ``gl33``
* Options: ``gl33``, ``gles30``, ``gles20``, ``null``
* Default: ``auto``
* Options: ``auto``, ``gl33``, ``gles30``, ``gles20``, ``null``
Sets the default renderer to use when Taisei launches.
When set to ``auto``, defaults to the first enabled backend in this order:
``gl33``, ``gles30``, ``gles20``.
The chosen backend must not be disabled.
.. code:: sh
# for GL 3.3 (default)
@ -490,20 +520,25 @@ Sets the default renderer to use when Taisei launches.
meson configure build/ -Dr_default=gles20
You can switch the renderer using the ``--renderer`` flag on the ``taisei``
binary. (i.e: ``taisei --renderer gl33``).
binary. (i.e: ``taisei --renderer gles30``).
Shader Transpiler (``-Dshader_transpiler``)
'''''''''''''''''''''''''''''''''''''''''''
* Default: ``false``
* Options: ``true``, ``false``
* Default: ``auto``
* Options: ``auto``, ``enabled``, ``disabled``
For using OpenGL ES, the shader transpiler is necessary for converting Taisei's
shaders to a format usable by that driver.
Requires ``shaderc`` and ``SPIRV-cross``.
Note that for Emscripten and Switch platforms, the translation is performed offline,
and this option is not available.
.. code:: sh
meson configure build/ -Dshader_transpiler=true
meson configure build/ -Dshader_transpiler=enabled
ANGLE
"""""

View file

@ -134,7 +134,7 @@ Video and OpenGL
portable).
**TAISEI_GL_DEBUG**
| Default: ``0`` for release builds, ``1`` for debug builds
| Default: ``0``
Enables OpenGL debugging. A debug context will be requested, all OpenGL
messages will be logged, and errors are fatal. Requires the ``KHR_debug``

View file

@ -1,27 +1,33 @@
if install_docs
rst2html_variants = []
# This is *completely* ridiculous, but apparently this thing has THAT many faces.
basenames = ['rst2html5', 'rst2html', 'rst2html4']
suffixes = ['', '-3', '3', '-docutils']
foreach basename : basenames
foreach suffix : suffixes
variant = '@0@@1@'.format(basename, suffix)
rst2html_variants += [variant, '@0@.py'.format(variant)]
endforeach
endforeach
rst2html5 = find_program(
rst2html_variants,
required : false
if angle_enabled
bindist_deps += custom_target('LICENSE.ANGLE',
command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'],
input : 'LICENSE.ANGLE',
output : 'LICENSE.txt',
install : true,
install_dir : angle_install_path
)
endif
if not rst2html5.found()
error('rst2html5 from docutils is required to build documentation. Please install it, or disable the `docs` option if you don\'t want it.')
endif
rst2html_variants = []
# This is *completely* ridiculous, but apparently this thing has THAT many faces.
basenames = ['rst2html5', 'rst2html', 'rst2html4']
suffixes = ['', '-3', '3', '-docutils']
foreach basename : basenames
foreach suffix : suffixes
variant = '@0@@1@'.format(basename, suffix)
rst2html_variants += [variant, '@0@.py'.format(variant)]
endforeach
endforeach
rst2html5 = find_program(
rst2html_variants,
required : get_option('docs')
)
if rst2html5.found()
rst_to_html = generator(rst2html5,
arguments : [
'--no-datestamp',
@ -67,14 +73,4 @@ if install_docs
depend_files : files('taisei.css')
)
endforeach
if angle_enabled
bindist_deps += custom_target('LICENSE.ANGLE',
command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'],
input : 'LICENSE.ANGLE',
output : 'LICENSE.txt',
install : true,
install_dir : angle_install_path
)
endif
endif

View file

@ -1,7 +1,11 @@
project('taisei', 'c',
license : 'MIT',
version : 'v1.4-dev',
meson_version : '>=0.53.0',
# NOTE: See https://github.com/mesonbuild/meson/issues/11163
version : run_command([
files('scripts/version.py'),
'--rootdir', meson.project_source_root(),
], check : true).stdout().strip(),
meson_version : '>=0.63.0',
default_options : [
'c_std=gnu11',
@ -63,12 +67,13 @@ project('taisei', 'c',
]
)
taisei_version_string = meson.project_version()
is_debug_build = get_option('debug')
is_developer_build = (get_option('developer') == 'auto' ? is_debug_build : get_option('developer') == 'true')
cc = meson.get_compiler('c')
python = import('python').find_installation()
macos_app_bundle = get_option('macos_bundle') and host_machine.system() == 'darwin'
subdir('scripts')
@ -136,11 +141,6 @@ elif deprecation_warnings == 'ignore'
taisei_c_args += '-Wno-deprecated-declarations'
endif
if meson.version().version_compare('<0.50.0') and get_option('b_pch')
# Workaround for Meson bug: https://github.com/mesonbuild/meson/issues/4905
taisei_c_args += ['-fpch-deps']
endif
taisei_c_args = cc.get_supported_arguments(taisei_c_args)
foreach arglist : [
@ -151,7 +151,7 @@ foreach arglist : [
endif
endforeach
sm_check = run_command(check_submodules_command)
sm_check = run_command(check_submodules_command, check : false)
if sm_check.stdout() != ''
foreach line : sm_check.stdout().strip().split('\n')
@ -163,19 +163,20 @@ if sm_check.stderr() != ''
warning('Submodule check completed with errors:\n@0@'.format(sm_check.stderr()))
endif
static = get_option('static') or ['emscripten', 'nx'].contains(host_machine.system())
opt_vfs_zip = get_option('vfs_zip').require(host_machine.system() != 'emscripten',
error_message : 'ZIP packages are not supported on Emscripten')
dep_freetype = dependency('freetype2', required : true, static : static, fallback : ['freetype', 'freetype_dep'])
dep_png = dependency('libpng', version : '>=1.5', required : true, static : static, fallback : ['libpng', 'png_dep'])
dep_sdl2 = dependency('sdl2', version : '>=2.0.10',required : true, static : static, fallback : ['sdl2', 'sdl2_dep'])
dep_webp = dependency('libwebp', version : '>=0.5', required : true, static : static, fallback : ['libwebp', 'webpdecoder_dep'])
dep_webpdecoder = dependency('libwebpdecoder', version : '>=0.5', required : false, static : static)
dep_zlib = dependency('zlib', required : true, static : static, fallback : ['zlib', 'zlib_dep'])
dep_zstd = dependency('libzstd', version : '>=1.4.0', required : true, static : static, fallback : ['libzstd', 'libzstd_dep'])
dep_zip = dependency('libzip', version : '>=1.5.0', required : false, static : static, fallback : ['libzip', 'libzip_dep'])
dep_cglm = dependency('cglm', version : '>=0.7.8', required : true, static : static, fallback : ['cglm', 'cglm_dep'])
dep_crypto = dependency('libcrypto', required : false, static : static)
dep_gamemode = dependency('gamemode', required : false, static : static)
dep_freetype = dependency('freetype2', required : true)
dep_png = dependency('libpng', version : '>=1.5', required : true)
dep_sdl2 = dependency('sdl2', version : '>=2.0.10',required : true)
dep_webp = dependency('libwebp', version : '>=0.5', required : true)
dep_webpdecoder = dependency('libwebpdecoder', version : '>=0.5', required : false)
dep_zlib = dependency('zlib', required : true)
dep_zstd = dependency('libzstd', version : '>=1.4.0', fallback : ['libzstd', 'libzstd_dep'])
dep_zip = dependency('libzip', version : '>=1.5.0', required : opt_vfs_zip, allow_fallback : true)
dep_cglm = dependency('cglm', version : '>=0.7.8', required : true)
dep_crypto = dependency('libcrypto', required : get_option('use_libcrypto'))
dep_gamemode = dependency('gamemode', required : false)
dep_m = cc.find_library('m', required : false)
@ -186,22 +187,20 @@ dep_koishi = subproject('koishi').get_variable('koishi_dep')
taisei_deps = [
dep_basisu_transcoder,
dep_cglm,
dep_crypto,
dep_freetype,
dep_gamemode,
dep_koishi,
dep_m,
dep_png,
dep_sdl2,
dep_zip,
dep_zlib,
dep_zstd,
# don't add glad here
]
if meson.version().version_compare('<0.49.0')
wrap_mode_forcefallback = false
else
wrap_mode_forcefallback = (get_option('wrap_mode') == 'forcefallback')
endif
wrap_mode_forcefallback = (get_option('wrap_mode') == 'forcefallback')
if dep_webpdecoder.found() and not wrap_mode_forcefallback
# distro libwebpdecoder
@ -215,25 +214,14 @@ if host_machine.system() == 'windows'
taisei_deps += cc.find_library('shlwapi')
endif
if host_machine.system() == 'emscripten'
package_data = false
enable_zip = false
else
package_data = get_option('package_data')
enable_zip = get_option('enable_zip')
package_data = (package_data == 'auto' ? enable_zip : package_data == 'true')
endif
package_data = (
get_option('package_data')
.require(dep_zip.found(),
error_message : 'libzip not found or VFS ZIP support is disabled')
.allowed()
)
if enable_zip
assert(dep_zip.found(), 'ZIP support enabled but libzip not found')
taisei_deps += dep_zip
endif
if package_data and not enable_zip
error('ZIP support must be enabled for data packaging to work')
endif
config.set('TAISEI_BUILDCONF_USE_ZIP', taisei_deps.contains(dep_zip))
config.set('TAISEI_BUILDCONF_USE_ZIP', dep_zip.found())
have_posix = cc.has_header_symbol('unistd.h', '_POSIX_VERSION')
@ -296,7 +284,7 @@ config.set('TAISEI_BUILDCONF_HAVE_BUILTIN_POPCOUNTLL', cc.has_function('__builti
config.set('TAISEI_BUILDCONF_HAVE_BUILTIN_POPCOUNT', cc.has_function('__builtin_popcount'))
config.set('TAISEI_BUILDCONF_HAVE_BUILTIN_AVAILABLE', cc.has_function('__builtin_available'))
if enable_zip and dep_zip.found()
if dep_zip.found()
if dep_zip.type_name() == 'internal'
have_zip_compression_method_supported = dep_zip.version().version_compare('>=1.7.0')
else
@ -317,52 +305,40 @@ force_relpath_systems = [
'nx'
]
if macos_app_bundle
bundle_dir = 'Taisei.app'
opt_install_macos_bundle = get_option('install_macos_bundle')
opt_install_macos_bundle = opt_install_macos_bundle.require(
host_machine.system() == 'darwin',
error_message : 'only supported on macOS')
bundle_datadir = join_paths('Contents', 'Resources')
bundle_bindir = join_paths('Contents', 'MacOS')
bundle_libdir = bundle_bindir
prefer_relocatable = (
host_machine.system() in (prefer_relpath_systems + force_relpath_systems) or
opt_install_macos_bundle.allowed())
datadir = join_paths(bundle_dir, bundle_datadir)
bindir = join_paths(bundle_dir, bundle_bindir)
libdir = join_paths(bundle_dir, bundle_libdir)
opt_install_relocatable = get_option('install_relocatable')
opt_install_relocatable = opt_install_relocatable.disable_auto_if(
not prefer_relocatable)
is_relocatable_install = true
opt_install_macos_bundle = opt_install_macos_bundle.require(
opt_install_relocatable.allowed(),
error_message : 'install_relocatable is required')
# arguments must be strings...
meson.add_install_script(
python.path(),
join_paths(meson.source_root(), 'scripts', 'macos-install-dylibs.py'),
':'.join(meson.get_cross_property('macos_lib_path', [])),
':'.join(meson.get_cross_property('macos_tool_path', [])),
meson.get_cross_property('macos_tool_prefix', ''),
)
else
datadir = get_option('datadir')
if force_relpath_systems.contains(host_machine.system())
is_relocatable_install = true
elif get_option('install_relative') == 'auto'
is_relocatable_install = prefer_relpath_systems.contains(host_machine.system())
else
is_relocatable_install = (get_option('install_relative') == 'true')
endif
if is_relocatable_install
bindir = '.'
libdir = '.'
else
bindir = get_option('bindir')
libdir = get_option('libdir')
endif
if host_machine.system() in force_relpath_systems and opt_install_relocatable.disabled()
error('install_relocatable must be enabled on this platform')
endif
if get_option('install_freedesktop') == 'auto'
install_xdg = not is_relocatable_install
else
install_xdg = get_option('install_freedesktop') == 'true'
endif
is_relocatable_install = opt_install_relocatable.allowed()
macos_app_bundle = opt_install_macos_bundle.allowed()
opt_install_freedesktop = (
get_option('install_freedesktop')
.disable_auto_if(is_relocatable_install or host_machine.system() == 'darwin')
.require(not macos_app_bundle,
error_message : 'installing freedesktop.org stuff into a macOS bundle makes no sense')
)
install_xdg = opt_install_freedesktop.allowed()
datadir = get_option('datadir')
if is_relocatable_install
data_path = 'data'
@ -371,22 +347,44 @@ if is_relocatable_install
lib_path = '.'
if macos_app_bundle
bundle_dir = 'Taisei.app'
bundle_datadir = join_paths('Contents', 'Resources')
bundle_bindir = join_paths('Contents', 'MacOS')
bundle_libdir = bundle_bindir
datadir = join_paths(bundle_dir, bundle_datadir)
bindir = join_paths(bundle_dir, bundle_bindir)
libdir = join_paths(bundle_dir, bundle_libdir)
# arguments must be strings...
meson.add_install_script(
python.path(),
join_paths(meson.source_root(), 'scripts', 'macos-install-dylibs.py'),
':'.join(meson.get_cross_property('macos_lib_path', [])),
':'.join(meson.get_cross_property('macos_tool_path', [])),
meson.get_cross_property('macos_tool_prefix', ''),
)
# Relative to SDL_GetBasePath() (bundle root)
config.set_quoted('TAISEI_BUILDCONF_DATA_PATH', join_paths(bundle_datadir, data_path))
config.set_quoted('TAISEI_BUILDCONF_LIB_PATH', join_paths(bundle_libdir))
# Make paths prefix-relative for installation
data_path = join_paths(datadir, data_path)
lib_path = libdir
# I don't know why would you do that, but more power to you
xdg_path = join_paths(datadir, xdg_path)
else
else # Relocatable; not macOS bundle
bindir = '.'
libdir = '.'
# Relative to SDL_GetBasePath() (typically contains the executable)
config.set_quoted('TAISEI_BUILDCONF_DATA_PATH', data_path)
config.set_quoted('TAISEI_BUILDCONF_LIB_PATH', '.')
config.set_quoted('TAISEI_BUILDCONF_LIB_PATH', lib_path)
endif
else
else # Non-relocatable
bindir = get_option('bindir')
libdir = get_option('libdir')
data_path = join_paths(datadir, 'taisei')
lib_path = join_paths(libdir, 'taisei')
doc_path = join_paths(datadir, 'doc', 'taisei')
@ -405,26 +403,17 @@ config.set('TAISEI_BUILDCONF_LOG_FATAL_MSGBOX', (
host_machine.system() == 'darwin' or
not is_developer_build
))
config.set('TAISEI_BUILDCONF_DEBUG_OPENGL', get_option('debug_opengl'))
install_docs = get_option('docs') and host_machine.system() != 'emscripten'
if host_machine.system() == 'windows'
if install_docs
custom_target('COPYING.txt',
command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'],
input : 'COPYING',
output : 'COPYING.txt',
install : true,
install_dir : doc_path
)
endif
custom_target('COPYING.txt',
command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'],
input : 'COPYING',
output : 'COPYING.txt',
install : true,
install_dir : doc_path
)
else
if install_docs
install_data('COPYING', install_dir : doc_path)
endif
install_data('COPYING', install_dir : doc_path)
endif
if angle_enabled
@ -443,7 +432,7 @@ if angle_enabled
endif
# Where to install the libs (prefix-relative)
# Also used in docs/meson.build to install the license
# Also used in doc/meson.build to install the license
angle_install_path = join_paths(lib_path, angle_dir)
# Where the game should look (either absolute or SDL_GetBasePath()-relative, depending on configuration)
@ -518,7 +507,7 @@ config.set('TAISEI_BUILDCONF_TESTING_STAGES', use_testing_stages)
# Stolen from Sway
# Compute the relative path used by compiler invocations.
source_root = meson.current_source_dir().split('/')
build_root = meson.build_root().split('/')
build_root = meson.project_build_root().split('/')
if build_machine.system() == 'windows'
source_root = source_root.replace('\\', '/')
build_root = build_root.replace('\\', '/')
@ -587,49 +576,35 @@ foreach bindist_target : bindist_targets
)
endforeach
summary = '''
meson.add_devenv({
'TAISEI_RES_PATH': meson.current_source_dir() / 'resources',
'TAISEI_GL_DEBUG': '1',
# TODO: Add support for this in libkoishi
'ASAN_OPTIONS': 'detect_stack_use_after_return=false',
})
Summary:
Taisei version: @0@
System type: @1@
Build type: @2@
Developer mode: @15@
Stages live reload: @16@
summary({
'System type' : systype,
'Build type' : get_option('buildtype'),
'Developer mode' : is_developer_build,
}, section : 'Main', bool_yn : true)
Audio backends: @3@ (default: @4@)
Renderers: @5@ (default: @6@)
Shader translation: @7@
ZIP support: @8@
Package data: @9@
summary({
'Audio backends' : '@0@ (default: @1@)'.format(', '.join(enabled_audio_backends), default_audio_backend),
'Rendering backends' : '@0@ (default: @1@)'.format(', '.join(enabled_renderers), default_renderer),
'Shader translation' : shader_transpiler_enabled,
'ZIP packages' : dep_zip.found(),
'Stages live reload' : stages_live_reload,
}, section : 'Features', bool_yn : true)
Relative install paths: @10@
Prefix: @11@
Executables: @12@
Data: @13@
Documentation: @14@
'''.format(
taisei_version_string,
systype,
get_option('buildtype'),
summary({
'Relocatable layout' : is_relocatable_install,
'Data in ZIP packages' : package_data,
'Bundle ANGLE libraries' : angle_enabled,
'Prefix' : get_option('prefix'),
'Executables' : join_paths('$prefix', bindir),
'Data' : join_paths('$prefix', data_path),
'Documentation' : join_paths('$prefix', doc_path),
}, section : 'Installation', bool_yn : true)
', '.join(enabled_audio_backends),
get_option('a_default'),
', '.join(enabled_renderers),
default_renderer,
get_option('shader_transpiler'),
enable_zip,
package_data,
is_relocatable_install,
get_option('prefix'),
# the $ is intentional
join_paths('$prefix', bindir),
join_paths('$prefix', data_path),
join_paths('$prefix', doc_path),
is_developer_build,
stages_live_reload
)
message(summary)
run_command(postconf_command)
run_command(postconf_command, check : false)

View file

@ -1,44 +1,74 @@
option(
'version_fallback',
type : 'string',
description : 'Overrides the version string when not building in a git repository'
)
option(
'developer',
type : 'combo',
choices : ['auto', 'true', 'false'],
choices : ['true', 'false', 'auto'],
value : 'false',
deprecated : ['auto'],
description : 'Make a "developer" build with cheats and extra debugging features'
)
option('vfs_zip',
type : 'feature',
value : 'auto',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Support loading of game data from ZIP packages (requires libzip)'
)
option(
'enable_zip',
type : 'boolean',
value : 'true',
description : 'Enable loading of game data from ZIP packages (requires libzip)'
deprecated : 'vfs_zip',
description : 'DEPRECATED: use vfs_zip instead',
)
option(
'package_data',
type : 'combo',
choices : ['auto', 'true', 'false'],
description : 'Package the games assets into a compressed archive (requires enable_zip)'
type : 'feature',
value : 'auto',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Package the games assets into a compressed archive (requires vfs_zip)'
)
option(
'install_relocatable',
type : 'feature',
value : 'auto',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Install everything into the same directory, don\'t hardcode absolute paths into the executable. Prefix is assumed to be an empty directory reserved for Taisei in this mode.'
)
option(
'install_relative',
type : 'combo',
choices : ['auto', 'true', 'false'],
description : 'Use only relative paths to the executable and install everything in the same directory. Always enabled for macOS bundles'
deprecated : 'install_relocatable',
description : 'DEPRECATED: use install_relocatable instead',
)
option(
'install_freedesktop',
type : 'combo',
choices : ['auto', 'true', 'false'],
type : 'feature',
value : 'auto',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Install freedesktop.org integration files (launchers, icons, replay file associations, etc.). Mostly relevant for Linux/BSD/etc. desktop systems'
)
option(
'install_macos_bundle',
type : 'feature',
value : 'auto',
deprecated : {'true' : 'auto', 'false' : 'disabled'},
description : 'Install into a macOS application bundle'
)
option(
'macos_bundle',
type : 'boolean',
deprecated : 'install_macos_bundle',
description : 'DEPRECATED: use install_macos_bundle instead',
)
option(
'install_angle',
type : 'boolean',
@ -69,97 +99,90 @@ option(
'static',
type : 'boolean',
value : false,
description : 'Build statically linked executable'
)
option(
'debug_opengl',
type : 'boolean',
value : true,
description : 'Enable OpenGL debugging. Create a debug context, enable logging, and crash the game on errors. Only available in debug builds'
)
option(
'macos_bundle',
type : 'boolean',
value : true,
description : 'Make a macOS application bundle on install (ignored on other platforms)'
deprecated : 'prefer_static',
description : 'DEPRECATED: use prefer_static instead',
)
option(
'docs',
type : 'boolean',
value : true,
description : 'Build and install documentation'
type : 'feature',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Build and install documentation (requires docutils)'
)
option(
'shader_transpiler',
type : 'boolean',
value : false,
type : 'feature',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Enable shader trans-compilation (requires shaderc)'
)
option(
'validate_glsl',
type : 'combo',
choices : ['auto', 'true', 'false'],
type : 'feature',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Enable validation of GLSL shaders (requires glslc)'
)
option(
'r_default',
type : 'combo',
choices : ['gl33', 'gles20', 'gles30', 'null'],
choices : ['auto', 'gl33', 'gles20', 'gles30', 'null'],
description : 'Which rendering backend to use by default'
)
option(
'r_gl33',
type : 'boolean',
value : true,
type : 'feature',
value : 'auto',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Build the OpenGL 3.3 Core renderer'
)
option(
'r_gles20',
type : 'boolean',
value : false,
type : 'feature',
value : 'disabled',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Build the OpenGL ES 2.0 renderer (incomplete)'
)
option(
'r_gles30',
type : 'boolean',
value : false,
type : 'feature',
value : 'auto',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Build the OpenGL ES 3.0 renderer'
)
option(
'r_null',
type : 'boolean',
value : true,
description : 'Build the no-op renderer (nothing is displayed)'
type : 'feature',
value : 'auto',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Build the no-op renderer (nothing is displayed). Required for --verify-replay to work properly'
)
option(
'a_default',
type : 'combo',
choices : ['sdl', 'null'],
choices : ['auto', 'sdl', 'null'],
description : 'Which audio backend to use by default'
)
option(
'a_sdl',
type : 'boolean',
value : true,
type : 'feature',
value : 'auto',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Build the SDL audio backend'
)
option(
'a_null',
type : 'boolean',
value : true,
type : 'feature',
value : 'auto',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Build the no-op audio backend (silence); you want this on!'
)
@ -172,8 +195,8 @@ option(
option(
'use_libcrypto',
type : 'combo',
choices : ['auto', 'true', 'false'],
type : 'feature',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Use libcrypto from OpenSSL for better SHA implementations'
)

View file

@ -23,6 +23,6 @@ RUN apt update && \
git
RUN pip3 install \
meson==0.56.2 \
meson==0.63.3 \
ninja \
zstandard

View file

@ -4,8 +4,9 @@ LABEL maintainer="Alice D. <alice@starwitch.productions>"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
RUN apt update && \
apt dist-upgrade -yqq && \
apt install -y --no-install-recommends \
apt-utils \
sudo \
ca-certificates \
@ -23,25 +24,25 @@ RUN apt-get update && \
python3-docutils \
python3-pip \
gdebi-core \
cmake && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
apt-transport-https \
cmake
RUN pip3 install \
meson==0.56.2 \
meson==0.63.3 \
ninja \
zstandard \
python-gnupg
RUN wget https://github.com/devkitPro/pacman/releases/latest/download/devkitpro-pacman.amd64.deb && \
gdebi -n devkitpro-pacman.amd64.deb && \
rm devkitpro-pacman.amd64.deb && \
dkp-pacman -Scc --noconfirm
ENV DEVKITPRO=/opt/devkitpro
ENV PATH=${DEVKITPRO}/tools/bin:$PATH
RUN ln -s /proc/self/mounts /etc/mtab
RUN mkdir -p /usr/local/share/keyring/ && \
curl https://apt.devkitpro.org/devkitpro-pub.gpg -o /usr/local/share/keyring/devkitpro-pub.gpg && \
echo "deb [signed-by=/usr/local/share/keyring/devkitpro-pub.gpg] https://apt.devkitpro.org stable main" > /etc/apt/sources.list.d/devkitpro.list && \
apt update && \
apt install devkitpro-pacman -yqq && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN dkp-pacman -Syyu --noconfirm \
switch-dev \

View file

@ -20,7 +20,7 @@ RUN apt-get update -qq && \
rm -rf /var/lib/apt/lists/*
RUN pip3 install \
meson==0.56.2 \
meson==0.63.3 \
ninja \
zstandard \
python-gnupg

View file

@ -0,0 +1,12 @@
[project options]
deprecation_warnings = 'no-error'
vfs_zip = 'enabled'
docs = 'enabled'
use_libcrypto = 'disabled'
force_vendored_shader_tools = true
validate_glsl = 'disabled'
[sdl2:project options]
use_joystick_wgi = 'disabled'

View file

@ -17,6 +17,10 @@ file_packager = toolchain / 'tools/file_packager'
needs_exe_wrapper = true
source_map_base = 'http://localhost:6931/'
[project options]
validate_glsl = 'enabled'
vfs_zip = 'disabled'
[built-in options]
b_ndebug = 'true'
b_pie = false
@ -34,11 +38,6 @@ default_library = 'static'
optimization = 's'
wrap_mode = 'forcefallback'
[project options]
enable_zip = false
force_vendored_shader_tools = true
package_data = 'false'
[sdl2:project options]
use_audio_alsa = 'disabled'
use_audio_pulseaudio = 'disabled'

View file

@ -5,9 +5,7 @@ cflags = ['-march='+march, '-mtune='+mtune]
ldflags = []
[project options]
deprecation_warnings = 'no-error'
use_libcrypto = 'false'
install_relative = 'true'
install_relocatable = 'enabled'
[built-in options]
c_args = cflags

View file

@ -5,9 +5,6 @@ mtune = 'skylake'
cflags = ['-march='+march, '-mtune='+mtune]
ldflags = []
[project options]
deprecation_warnings = 'no-error'
[built-in options]
c_args = cflags
c_link_args = ldflags

View file

@ -21,7 +21,7 @@ pkgconfig = 'pkg-config'
needs_exe_wrapper = true
[project options]
deprecation_warnings = 'no-error'
install_macos_bundle = 'enabled'
[built-in options]
c_args = cflags

View file

@ -5,9 +5,6 @@ macos_min = '10.9'
cflags = ['-mmacosx-version-min='+macos_min, '-march='+march, '-mtune='+mtune]
ldflags = ['-mmacosx-version-min='+macos_min]
[project options]
deprecation_warnings = 'no-error'
[built-in options]
c_args = cflags
c_link_args = ldflags

View file

@ -7,9 +7,6 @@ cflags = ['-mmacosx-version-min='+macos_min, '-march='+march, '-mtune='+mtune]
# NOTE: might need to pass -sdk_version to the linker as well, not sure how that works...
ldflags = ['-mmacosx-version-min='+macos_min]
[project options]
deprecation_warnings = 'no-error'
[built-in options]
c_args = cflags
c_link_args = ldflags

View file

@ -0,0 +1,4 @@
[project options]
validate_glsl = 'enabled'

View file

@ -34,10 +34,9 @@ windres = exeprefix+'windres'
ld = exeprefix+'ld'
[project options]
deprecation_warnings = 'no-error'
install_angle = true
r_gles30 = true
shader_transpiler = true
r_gles30 = 'enabled'
shader_transpiler = 'enabled'
[built-in options]
c_args = cflags

View file

@ -34,10 +34,9 @@ windres = exeprefix+'windres'
ld = exeprefix+'ld'
[project options]
deprecation_warnings = 'no-error'
install_angle = true
r_gles30 = true
shader_transpiler = true
r_gles30 = 'enabled'
shader_transpiler = 'enabled'
[built-in options]
c_args = cflags

View file

@ -34,9 +34,6 @@ widl = exeprefix+'widl'
windres = exeprefix+'windres'
ld = exeprefix+'ld'
[project options]
deprecation_warnings = 'no-error'
[built-in options]
c_args = cflags
c_link_args = ldflags

View file

@ -153,28 +153,30 @@ spvc_vert_args = [
'--stage', 'vert',
]
if ['emscripten', 'nx'].contains(host_machine.system())
validate_glsl = 'true'
transpile_glsl = true
else
validate_glsl = get_option('validate_glsl')
transpile_glsl = false
transpile_glsl = (host_machine.system() in ['emscripten', 'nx'])
opt_validate_glsl = get_option('validate_glsl')
if opt_validate_glsl.disabled() and transpile_glsl
error('GLSL validation can\'t be disabled on this platform')
endif
force_vendored_shader_tools = get_option('force_vendored_shader_tools')
force_validate_glsl = (
opt_validate_glsl.enabled() or
transpile_glsl or
(force_vendored_shader_tools and opt_validate_glsl.allowed())
)
if force_vendored_shader_tools and validate_glsl != 'false'
validate_glsl = 'true'
endif
validate_glsl = false
if validate_glsl != 'false'
if opt_validate_glsl.allowed()
if force_vendored_shader_tools
glslc_command = disabler()
else
glslc_command = find_program('glslc', required : false)
endif
if not glslc_command.found() and validate_glsl == 'true'
if not glslc_command.found() and force_validate_glsl
glslc_command = subproject('shaderc').get_variable('glslc_native')
glslc_args += '-Werror'
validate_glsl = true
@ -184,7 +186,8 @@ if validate_glsl != 'false'
glslc_frag_args,
glslc_test_uniform_location_file,
'-o', '-',
capture : false
capture : false,
check : false
)
if test_result.returncode() == 0
@ -199,7 +202,8 @@ if validate_glsl != 'false'
glslc_frag_args,
glslc_test_basic_file,
'-o', '-',
capture : false
capture : false,
check : false
)
if test_result.returncode() == 0
@ -207,12 +211,12 @@ if validate_glsl != 'false'
else
warning(test_result.stderr())
if validate_glsl == 'auto'
warning('Basic glslc test failed, you probably have a broken/incompatible version. GLSL validation will be disabled.')
validate_glsl = false
else
if force_validate_glsl
error('Basic glslc test failed, you probably have a broken/incompatible version.')
endif
warning('Basic glslc test failed, you probably have a broken/incompatible version. GLSL validation will be disabled.')
validate_glsl = false
endif
else
warning('GLSL validation or translation requested, but glslc was not found')
@ -232,10 +236,10 @@ if validate_glsl != 'false'
glslc_args += ['-Os', '-g']
endif
else
validate_glsl = false
endif
transpile_glsl = transpile_glsl and validate_glsl
# @begin validate
if validate_glsl
foreach src : glsl_files

View file

@ -65,8 +65,7 @@ foreach pkg : packages
var_files = 'em_bundle_@0@_files'.format(bundle)
var_packer_args = 'em_bundle_@0@_packer_args'.format(bundle)
glob_result = run_command(glob_command, pkg_path, get_variable(var_patterns))
assert(glob_result.returncode() == 0, 'Glob script failed')
glob_result = run_command(glob_command, pkg_path, get_variable(var_patterns), check : true)
foreach file : glob_result.stdout().strip().split('\n')
if file != ''
@ -95,8 +94,7 @@ foreach pkg : packages
console : true,
)
else
glob_result = run_command(glob_command, pkg_path, '**/meson.build')
assert(glob_result.returncode() == 0, 'Glob script failed')
glob_result = run_command(glob_command, pkg_path, '**/meson.build', check : true)
install_subdir(pkg_pkgdir, install_dir : data_path, exclude_files : glob_result.stdout().split('\n'))
endif
endforeach
@ -122,8 +120,7 @@ if host_machine.system() == 'nx'
console : true,
)
else
glob_result = run_command(glob_command, shaders_build_dir, '**/*.spv', '**/meson.build')
assert(glob_result.returncode() == 0, 'Glob script failed')
glob_result = run_command(glob_command, shaders_build_dir, '**/*.spv', '**/meson.build', check : true)
install_subdir(shaders_build_dir, install_dir : data_path, exclude_files : glob_result.stdout().split('\n'))
endif
endif

View file

@ -5,5 +5,15 @@ set -e
source $(pwd)/.mac_env
mkdir -p $MAC_BUILD_DIR/compiled $MESON_BUILD_ROOT_MACOS_COMBINED
meson setup --native-file $TAISEI_ROOT/misc/ci/macos-x86_64-build-release.ini --prefix $MESON_BUILD_ROOT_MACOS_X64_COMPILED $MESON_BUILD_ROOT_MACOS_X64 $TAISEI_ROOT
meson setup --cross-file $TAISEI_ROOT/misc/ci/macos-aarch64-build-release.ini --prefix $MESON_BUILD_ROOT_MACOS_AARCH64_COMPILED $MESON_BUILD_ROOT_MACOS_AARCH64 $TAISEI_ROOT
meson setup \
--native-file $TAISEI_ROOT/misc/ci/common-options.ini \
--native-file $TAISEI_ROOT/misc/ci/macos-x86_64-build-release.ini \
--prefix $MESON_BUILD_ROOT_MACOS_X64_COMPILED \
$MESON_BUILD_ROOT_MACOS_X64 \
$TAISEI_ROOT
meson setup \
--cross-file $TAISEI_ROOT/misc/ci/common-options.ini \
--cross-file $TAISEI_ROOT/misc/ci/macos-aarch64-build-release.ini \
--prefix $MESON_BUILD_ROOT_MACOS_AARCH64_COMPILED \
$MESON_BUILD_ROOT_MACOS_AARCH64 \
$TAISEI_ROOT

View file

@ -1,46 +1,25 @@
ver_fb = get_option('version_fallback').strip()
version_fallback = ver_fb != '' ? ver_fb : meson.project_version()
common_taiseilib_args = [
'--rootdir', meson.source_root(),
'--fallback-version', version_fallback
'--rootdir', meson.project_source_root(),
]
common_taiseilib_defs = [
'-DMESON_BUILD_ROOT=@0@'.format(meson.build_root()),
'-DMESON_SOURCE_ROOT=@0@'.format(meson.source_root()),
'-DMESON_BUILD_ROOT=@0@'.format(meson.project_build_root()),
'-DMESON_SOURCE_ROOT=@0@'.format(meson.project_source_root()),
]
# Workaround for Meson bug: https://github.com/mesonbuild/meson/issues/4947
python_thunk = find_program(files('thunk.py'))
preprocess_script = find_program(files('configure-file.py'))
preprocess_args = common_taiseilib_args + common_taiseilib_defs
preprocess_command = [preprocess_script, preprocess_args]
version_script = files('version.py')
version_command = [python_thunk, version_script, common_taiseilib_args]
taisei_version_result = run_command(version_command, '{string}')
assert(taisei_version_result.returncode() == 0, 'Version script failed')
if taisei_version_result.stderr() != ''
warning(taisei_version_result.stderr().strip())
endif
taisei_version_string = taisei_version_result.stdout().strip()
preprocess_script = files('configure-file.py')
# generators are string supremacists apparently...
preprocess_script_path = join_paths(meson.source_root(), '@0@'.format(preprocess_script[0]))
preprocess_args = [preprocess_script_path] + common_taiseilib_args + common_taiseilib_defs
preprocess_command = [python_thunk, preprocess_args]
preprocessor = generator(preprocess_command[0],
preprocessor = generator(preprocess_script,
arguments: preprocess_args + ['@EXTRA_ARGS@', '--depfile', '@DEPFILE@', '@INPUT@', '@OUTPUT@'],
output: '@BASENAME@',
depfile: '@BASENAME@.d',
)
eolconv_script = files('eolconv.py')
eolconv_command = [python_thunk, eolconv_script]
eolconv_script = find_program(files('eolconv.py'))
eolconv_command = [eolconv_script]
package_system_name = host_machine.system()
@ -62,39 +41,39 @@ if is_debug_build
dist_version_string = '@0@-debug'.format(dist_version_string)
endif
dist_script = files('gen-dist.py')
dist_script = find_program(files('gen-dist.py'))
dist_name = 'Taisei-@0@-@1@-@2@'.format(dist_version_string, package_system_name, host_machine.cpu_family())
dist_command = [python_thunk, dist_script, common_taiseilib_args]
dist_command = [dist_script, common_taiseilib_args]
dist_prefix_args = ['--prefix=@0@'.format(dist_name)]
zip_filename = '@0@.zip'.format(dist_name)
zip_outpath = join_paths(meson.build_root(), zip_filename)
zip_command = [dist_command, '--format=zip', meson.build_root(), zip_outpath]
zip_outpath = join_paths(meson.project_build_root(), zip_filename)
zip_command = [dist_command, '--format=zip', meson.project_build_root(), zip_outpath]
txz_filename = '@0@.tar.xz'.format(dist_name)
txz_outpath = join_paths(meson.build_root(), txz_filename)
txz_command = [dist_command, '--format=xztar', dist_prefix_args, meson.build_root(), txz_outpath]
txz_outpath = join_paths(meson.project_build_root(), txz_filename)
txz_command = [dist_command, '--format=xztar', dist_prefix_args, meson.project_build_root(), txz_outpath]
tgz_filename = '@0@.tar.gz'.format(dist_name)
tgz_outpath = join_paths(meson.build_root(), tgz_filename)
tgz_command = [dist_command, '--format=gztar', dist_prefix_args, meson.build_root(), tgz_outpath]
tgz_outpath = join_paths(meson.project_build_root(), tgz_filename)
tgz_command = [dist_command, '--format=gztar', dist_prefix_args, meson.project_build_root(), tgz_outpath]
tbz_filename = '@0@.tar.bz2'.format(dist_name)
tbz_outpath = join_paths(meson.build_root(), tbz_filename)
tbz_command = [dist_command, '--format=bztar', dist_prefix_args, meson.build_root(), tbz_outpath]
tbz_outpath = join_paths(meson.project_build_root(), tbz_filename)
tbz_command = [dist_command, '--format=bztar', dist_prefix_args, meson.project_build_root(), tbz_outpath]
tar_filename = '@0@.tar'.format(dist_name)
tar_outpath = join_paths(meson.build_root(), tar_filename)
tar_command = [dist_command, '--format=tar', dist_prefix_args, meson.build_root(), tar_outpath]
tar_outpath = join_paths(meson.project_build_root(), tar_filename)
tar_command = [dist_command, '--format=tar', dist_prefix_args, meson.project_build_root(), tar_outpath]
dmg_script = files('macos-gen-dmg.py')
dmg_script = find_program(files('macos-gen-dmg.py'))
dmg_filename = '@0@.dmg'.format(dist_name)
dmg_command = [python_thunk, dmg_script, join_paths(meson.build_root(), dmg_filename), meson.build_root()]
dmg_command = [dmg_script, join_paths(meson.project_build_root(), dmg_filename), meson.project_build_root()]
angle_enabled = get_option('install_angle')
if package_system_name == 'windows'
nsis_script = files('win-gen-nsis.py')
nsis_script = find_program(files('win-gen-nsis.py'))
nsis_filename = 'Taisei-@0@-setup-@1@.exe'.format(dist_version_string, host_machine.cpu_family())
nsis_outpath = join_paths(meson.build_root(), nsis_filename)
@ -115,7 +94,6 @@ if package_system_name == 'windows'
endif
nsis_command = [
python_thunk,
nsis_script,
common_taiseilib_args,
common_taiseilib_defs,
@ -125,33 +103,36 @@ if package_system_name == 'windows'
]
endif
gen_atlas_script = files('gen-atlas.py')
gen_atlas_command = [python_thunk, gen_atlas_script]
gen_atlas_script = find_program(files('gen-atlas.py'))
gen_atlas_command = [gen_atlas_script]
gen_atlases_script = files('gen-atlases.py')
gen_atlases_command = [python_thunk, gen_atlases_script]
gen_atlases_script = find_program(files('gen-atlases.py'))
gen_atlases_command = [gen_atlases_script]
upkeep_script = files('upkeep.py')
upkeep_command = [python_thunk, upkeep_script, common_taiseilib_args]
upkeep_script = find_program(files('upkeep.py'))
upkeep_command = [upkeep_script, common_taiseilib_args]
upkeep_target = run_target('upkeep', command: upkeep_command)
postconf_script = files('dump-build-options.py')
postconf_command = [python_thunk, postconf_script]
postconf_script = find_program(files('dump-build-options.py'))
postconf_command = [postconf_script]
pack_script = files('pack.py')
pack_command = [python_thunk, pack_script, common_taiseilib_args]
pack_script = find_program(files('pack.py'))
pack_command = [pack_script, common_taiseilib_args]
glob_script = files('glob-search.py')
glob_command = [python_thunk, glob_script]
glob_script = find_program(files('glob-search.py'))
glob_command = [glob_script]
check_submodules_script = files('check-submodules.py')
check_submodules_command = [python_thunk, check_submodules_script]
check_submodules_script = find_program(files('check-submodules.py'))
check_submodules_command = [check_submodules_script]
em_set_bundle_uuid_script = files('em-set-bundle-uuid.py')
em_set_bundle_uuid_command = [python_thunk, em_set_bundle_uuid_script]
em_set_bundle_uuid_script = find_program(files('em-set-bundle-uuid.py'))
em_set_bundle_uuid_command = [em_set_bundle_uuid_script]
fix_path_script = files('unfuck-path.py')
fix_path_command = [python_thunk, fix_path_script]
fix_path_script = find_program(files('unfuck-path.py'))
fix_path_command = [fix_path_script]
format_array_script = files('format-array.py')
format_array_command = [python_thunk, format_array_script]
format_array_script = find_program(files('format-array.py'))
format_array_command = [format_array_script]
on_dist_script = find_program(files('on-meson-dist.py'))
meson.add_dist_script(on_dist_script)

46
scripts/on-meson-dist.py Executable file
View file

@ -0,0 +1,46 @@
#!/usr/bin/env python3
import os
import sys
import pathlib
import taiseilib.version
import shutil
def main(args):
def env_dir_path(v):
try:
s = os.environ[v]
except KeyError:
print("{} is not set".format(v))
p = pathlib.Path(s)
assert p.is_dir()
return p
src_root = env_dir_path('MESON_PROJECT_SOURCE_ROOT')
dist_root = env_dir_path('MESON_PROJECT_DIST_ROOT')
src_version = taiseilib.version.get(rootdir=src_root)
(dist_root / taiseilib.version.OVERRIDE_FILE_NAME).write_text(src_version.string)
remove_files = [
'.dockerignore',
'.gitattributes',
'.gitignore',
'.gitmodules',
'.mailmap',
'checkout',
'pull',
]
for fname in remove_files:
(dist_root / fname).unlink(fname)
shutil.rmtree(str(dist_root / '.github'))
if __name__ == '__main__':
from taiseilib.common import run_main
run_main(main)

View file

@ -5,12 +5,17 @@ import sys
import subprocess
import shlex
import re
import os
class VersionFormatError(common.TaiseiError):
pass
VERSION_FALLBACK = 'v1.4-dev'
OVERRIDE_FILE_NAME = '.VERSION'
class Version(object):
regex = re.compile(r'^v?(\d+)(?:\.(\d+)(?:\.(\d+))?)?(?:[-+](\d+))?(?:[-+](.*))?$')
@ -53,13 +58,23 @@ class Version(object):
return template.format(**self.__dict__)
def get(*, rootdir=None, fallback=None, args=common.default_args):
def get(*, rootdir=None, fallback=VERSION_FALLBACK, args=common.default_args):
rootdir = rootdir if rootdir is not None else args.rootdir
fallback = fallback if fallback is not None else args.fallback_version
if rootdir is None:
import pathlib
rootdir = pathlib.Path(__file__).parent
elif not isinstance(rootdir, os.PathLike):
rootdir = pathlib.Path(rootdir)
version_override_path = rootdir / OVERRIDE_FILE_NAME
try:
version_str = version_override_path.read_text().strip()
except FileNotFoundError:
pass
else:
return Version(version_str)
try:
version_str = subprocess.check_output(
@ -80,6 +95,7 @@ def get(*, rootdir=None, fallback=None, args=common.default_args):
print(e, file=sys.stderr)
print("Warning: git not found or not a git repository; using fallback version {0}".format(fallback), file=sys.stderr)
print("Hint: if you are packaging Taisei, write the appropriate version into", str(version_override_path), file=sys.stderr)
version_str = fallback
return Version(version_str)

View file

@ -1,10 +0,0 @@
#!/usr/bin/env python3
import os
import sys
import runpy
assert len(sys.argv) > 1
sys.argv = sys.argv[1:]
sys.path.insert(0, os.path.dirname(sys.argv[0]))
runpy.run_path(sys.argv[0], run_name='__main__')

View file

@ -8,11 +8,13 @@
#include "taisei.h"
#include "arch_switch.h"
#include "renderer/glcommon/debug.h"
#include <unistd.h>
#include <switch/services/applet.h>
#include <switch/services/fs.h>
#include <switch/services/ssl.h>
#include <switch/services/nifm.h>
#include <switch/runtime/devices/socket.h>
#include <switch/runtime/nxlink.h>
@ -58,24 +60,24 @@ void userAppInit(void) {
getcwd(g_programDir, FS_MAX_PATH);
#if defined(DEBUG) && defined(TAISEI_BUILDCONF_DEBUG_OPENGL)
// enable Mesa logging:
NX_SETENV("EGL_LOG_LEVEL", "debug");
NX_SETENV("MESA_VERBOSE", "all");
NX_SETENV("MESA_DEBUG", "1");
NX_SETENV("MESA_INFO", "1");
NX_SETENV("MESA_GLSL", "errors");
NX_SETENV("NOUVEAU_MESA_DEBUG", "1");
NX_SETENV("LIBGL_DEBUG", "verbose");
if(glcommon_debug_requested()) {
// enable Mesa logging:
NX_SETENV("EGL_LOG_LEVEL", "debug");
NX_SETENV("MESA_VERBOSE", "all");
NX_SETENV("MESA_DEBUG", "1");
NX_SETENV("MESA_INFO", "1");
NX_SETENV("MESA_GLSL", "errors");
NX_SETENV("NOUVEAU_MESA_DEBUG", "1");
NX_SETENV("LIBGL_DEBUG", "verbose");
// enable shader debugging in Nouveau:
NX_SETENV("NV50_PROG_OPTIMIZE", "0");
NX_SETENV("NV50_PROG_DEBUG", "1");
NX_SETENV("NV50_PROG_CHIPSET", "0x120");
#else
// disable error checking and save CPU time
NX_SETENV("MESA_NO_ERROR", "1");
#endif
// enable shader debugging in Nouveau:
NX_SETENV("NV50_PROG_OPTIMIZE", "0");
NX_SETENV("NV50_PROG_DEBUG", "1");
NX_SETENV("NV50_PROG_CHIPSET", "0x120");
} else {
// disable error checking and save CPU time
NX_SETENV("MESA_NO_ERROR", "1");
}
}
attr_used

View file

@ -1,39 +1,55 @@
default_backend = get_option('a_default')
audio_backend_opts = {
'sdl' : get_option('a_sdl'),
'null' : get_option('a_null'),
}
if default_backend == 'sdl2mixer'
error('Your build directory is outdated. Try running the following command:\n\n$ meson --wipe @0@ @1@ -Da_default=sdl\n'.format(meson.source_root(), meson.build_root()))
default_audio_backend = get_option('a_default')
audio_backends_prio = ['sdl', 'null']
if default_audio_backend == 'auto'
foreach audio_backend : audio_backends_prio
if audio_backend_opts[audio_backend].allowed()
default_audio_backend = audio_backend
break
endif
endforeach
if default_audio_backend == 'auto'
audio_backends_prio_opts = []
foreach audio_backend : audio_backends_prio
audio_backends_prio_opts + f'a_@audio_backend@'
endforeach
audio_backends_prio_opts = ', '.join(audio_backends_prio_opts)
error('Could not pick a default audio backend. ' +
f'Make sure you have at least one of audio_backends_prio_opts enabled.')
endif
endif
if not get_option('a_@0@'.format(default_backend))
error('Default audio backend \'@0@\' is not enabled. Enable it with -Da_@0@=true, or set a_default to something else.'.format(default_backend))
endif
assert(audio_backend_opts[default_audio_backend].allowed(),
f'Default audio backend @default_audio_backend@ is not enabled')
audio_src = files(
'audio.c',
'backend.c',
)
modules = [
'sdl',
'null',
]
audio_deps = []
enabled_audio_backends = []
included_deps = []
needed_deps = []
a_macro = []
foreach m : modules
if get_option('a_@0@'.format(m))
subdir(m)
included_deps += [m]
enabled_audio_backends += [m]
a_macro += ['A(@0@)'.format(m)]
audio_src += get_variable('a_@0@_src'.format(m))
needed_deps += get_variable('a_@0@_deps'.format(m))
audio_deps += get_variable('a_@0@_libdeps'.format(m))
foreach audio_backend, aopt : audio_backend_opts
if aopt.allowed()
subdir(audio_backend)
included_deps += [audio_backend]
enabled_audio_backends += [audio_backend]
a_macro += ['A(@0@)'.format(audio_backend)]
audio_src += get_variable(f'a_@audio_backend@_src')
needed_deps += get_variable(f'a_@audio_backend@_deps')
audio_deps += get_variable(f'a_@audio_backend@_libdeps')
endif
endforeach
@ -48,4 +64,4 @@ endforeach
a_macro = ' '.join(a_macro)
config.set('TAISEI_BUILDCONF_AUDIO_BACKENDS', a_macro)
config.set_quoted('TAISEI_BUILDCONF_AUDIO_DEFAULT', default_backend)
config.set_quoted('TAISEI_BUILDCONF_AUDIO_DEFAULT', default_audio_backend)

View file

@ -7,7 +7,7 @@ a_stream_src = files(
'stream_pcm.c',
)
dep_opusfile = dependency('opusfile', required : true, static : static, fallback : ['opusfile', 'opusfile_dep'])
dep_opusfile = dependency('opusfile')
a_stream_deps = []
a_stream_libdeps = [dep_opusfile]

View file

@ -445,19 +445,15 @@ elif host_machine.system() == 'nx'
taisei_nro_name = '@0@.nro'.format(taisei_basename)
taisei_nro = custom_target(taisei_nro_name,
# NOTE: Unfortunately we can't just put 'taisei_elf' directly into the command array.
# Meson then makes an invalid assumption that we are going to execute it ("use as a generator"),
# and aborts because there's no exe wrapper in the cross file (which wouldn't make sense to have).
command : [
find_program('elf2nro'),
taisei_elf.full_path(), # workaround for the above issue
taisei_elf,
'@OUTPUT@',
'--nacp=@0@'.format(taisei_nacp.full_path()), # if we could pass the path in a standalone argument, we could have meson generate an implicit dependency here...
'--icon=@0@'.format(nx_icon_path),
],
build_by_default : true,
depends : [taisei_elf, taisei_nacp],
depends : [taisei_nacp],
install : true,
install_dir : bindir,
output : taisei_nro_name,
@ -468,7 +464,7 @@ else
dependencies : taisei_deps,
c_args : taisei_c_args,
c_pch : 'pch/taisei_pch.h',
gui_app : not get_option('win_console'),
win_subsystem : get_option('win_console') ? 'console' : 'windows',
install : true,
install_dir : bindir,
export_dynamic : stages_live_reload,

View file

@ -8,41 +8,14 @@ r_shaderlib_src = files(
r_shaderlib_libdeps = []
if get_option('shader_transpiler')
dep_spvc = dependency('spirv-cross-c-shared', required : true, static : static, fallback : ['SPIRV-Cross', 'spirv_cross_dep'])
if get_option('wrap_mode') != 'forcefallback'
dep_shaderc = dependency('shaderc', static : static, required : false)
if not dep_shaderc.found()
# Thanks, google.
# https://github.com/google/shaderc/issues/392
if static
dep_shaderc = cc.find_library('shaderc_combined', required : false)
else
dep_shaderc = cc.find_library('shaderc_shared', required : false)
endif
endif
if not dep_shaderc.found()
dep_shaderc = dependency('shaderc', static : static, fallback : ['shaderc', 'shaderc_dep'], required : true)
endif
else
dep_shaderc = dependency('shaderc', static : static, fallback : ['shaderc', 'shaderc_dep'], required : true)
endif
assert(dep_shaderc.found(), 'shaderc is required for the shader transpiler')
r_shaderlib_src += files(
'lang_spirv.c'
)
opt_shader_transpiler = get_option('shader_transpiler')
dep_spvc = dependency('spirv-cross-c-shared', required : opt_shader_transpiler)
dep_shaderc = dependency('shaderc', required : opt_shader_transpiler)
shader_transpiler_enabled = dep_spvc.found() and dep_shaderc.found()
if shader_transpiler_enabled
r_shaderlib_src += files('lang_spirv.c')
r_shaderlib_libdeps += [dep_shaderc, dep_spvc]
if false and host_machine.system() == 'windows' and get_option('b_lto') and get_option('static') and cc.get_id() == 'gcc'
warning('LTO is known to break glslang on GCC-mingw64 based toolchains')
endif
else
r_shaderlib_src += files(
'lang_spirv_stub.c'
)
r_shaderlib_src += files('lang_spirv_stub.c')
endif

View file

@ -113,7 +113,7 @@ void glcommon_debug_enable(void) {
#endif
bool glcommon_debug_requested(void) {
return env_get("TAISEI_GL_DEBUG", DEBUG_GL_DEFAULT);
return env_get("TAISEI_GL_DEBUG", false);
}
void glcommon_set_debug_label_local(char *label_storage, const char *kind_name, GLuint gl_handle, const char *label) {

View file

@ -148,12 +148,6 @@ ext_flag_t glcommon_check_extension(const char *ext) attr_nonnull_all;
ext_flag_t glcommon_require_extension(const char *ext) attr_nonnull_all;
void glcommon_setup_attributes(SDL_GLprofile profile, uint major, uint minor, SDL_GLcontextFlag ctxflags);
#if defined(DEBUG) && defined(TAISEI_BUILDCONF_DEBUG_OPENGL)
#define DEBUG_GL_DEFAULT 1
#else
#define DEBUG_GL_DEFAULT 0
#endif
struct glext_s {
struct {
char major;

View file

@ -1,22 +1,47 @@
modules = [
'gl33',
'gles20',
'gles30',
'null',
]
if ['nx', 'emscripten'].contains(host_machine.system())
forced_renderer = 'gles30'
else
forced_renderer = ''
subdir('common')
renderer_opts = {
'gl33' : get_option('r_gl33').require(
host_machine.system() not in ['nx', 'emscripten'],
error_message : 'OpenGL 3.3 is not supported on this platform'),
'gles20' : get_option('r_gles20').disable_auto_if(not shader_transpiler_enabled),
'gles30' : get_option('r_gles30').disable_auto_if(
not (shader_transpiler_enabled or transpile_glsl)),
'null' : get_option('r_null'),
}
default_renderer = get_option('r_default')
renderers_prio = ['gl33', 'gles30', 'gles20']
if default_renderer == 'auto'
foreach renderer : renderers_prio
if renderer_opts[renderer].allowed()
default_renderer = renderer
break
endif
endforeach
if default_renderer == 'auto'
renderers_prio_opts = []
foreach renderer : renderers_prio
renderers_prio_opts + f'r_@renderer@'
endforeach
renderers_prio_opts = ', '.join(renderers_prio_opts)
error('Could not pick a default renderer. ' +
f'Make sure you have at least one of @renderers_prio_opts@ enabled, ' +
'or force r_default=null if you really mean it.')
endif
endif
default_renderer = (forced_renderer == '') ? get_option('r_default') : forced_renderer
static_gles30 = (host_machine.system() == 'emscripten')
assert(renderer_opts[default_renderer].allowed(),
f'Default renderer @default_renderer@ is not enabled')
if forced_renderer == '' and not get_option('r_@0@'.format(default_renderer))
error('Default renderer \'@0@\' is not enabled. Enable it with -Dr_@0@=true, or set r_default to something else.'.format(default_renderer))
endif
static_gles30 = (
renderer_opts['gles30'].allowed() and
host_machine.system() == 'emscripten'
)
renderer_src = files(
'api.c',
@ -27,7 +52,6 @@ enabled_renderers = []
# NOTE: Order matters here.
subdir('null')
subdir('common')
subdir('glcommon')
subdir('gl33')
subdir('glescommon')
@ -38,15 +62,14 @@ included_deps = []
needed_deps = ['common']
r_macro = []
foreach m : modules
should_include = (forced_renderer == '') ? get_option('r_@0@'.format(m)) : (m == forced_renderer)
if should_include
renderer_src += get_variable('r_@0@_src'.format(m))
r_macro += ['R(@0@)'.format(m)]
enabled_renderers += [m]
needed_deps += get_variable('r_@0@_deps'.format(m))
included_deps += [m]
renderer_deps += get_variable('r_@0@_libdeps'.format(m))
foreach renderer, ropt : renderer_opts
if ropt.allowed()
renderer_src += get_variable(f'r_@renderer@_src')
r_macro += f'R(@renderer@)'
enabled_renderers += renderer
needed_deps += get_variable(f'r_@renderer@_deps')
included_deps += renderer
renderer_deps += get_variable(f'r_@renderer@_libdeps')
endif
endforeach
@ -62,9 +85,11 @@ r_macro = ' '.join(r_macro)
config.set('TAISEI_BUILDCONF_RENDERER_BACKENDS', r_macro)
config.set_quoted('TAISEI_BUILDCONF_RENDERER_DEFAULT', default_renderer)
if angle_enabled
assert(
enabled_renderers.contains('gles30') or enabled_renderers.contains('gles20'),
'An OpenGL ES renderer is required to use ANGLE. Enable r_gles30 or r_gles20, or disable install_angle.'
)
have_gles_renderer = (
renderer_opts['gles30'].allowed() or
renderer_opts['gles20'].allowed())
if angle_enabled and not have_gles_renderer
error('An OpenGL ES renderer is required to use ANGLE. ' +
'Enable r_gles30 or r_gles20, or disable install_angle.')
endif

View file

@ -11,7 +11,7 @@ rwops_src = files(
'rwops_zstd.c',
)
if taisei_deps.contains(dep_zip)
if dep_zip.found()
rwops_src += files(
'rwops_zipfile.c',
)

View file

@ -29,18 +29,8 @@ config.set('TAISEI_BUILDCONF_USE_DESIGNATED_INIT', cc.compiles(
args : ['-Wattributes', '-Werror']
))
use_libcrypto = get_option('use_libcrypto')
if use_libcrypto == 'auto'
use_libcrypto = dep_crypto.found()
else
use_libcrypto = (use_libcrypto == 'true')
endif
if use_libcrypto
assert(dep_crypto.found(), 'use_libcrypto forced but libcrypto not found. Install OpenSSL or disable use_libcrypto.')
if dep_crypto.found()
util_src += files('sha256_openssl.c')
util_deps += [dep_crypto]
else
util_src += files('sha256.c')
endif

View file

@ -14,7 +14,7 @@ vfs_src = files(
'zipfile_public.c',
)
if taisei_deps.contains(dep_zip)
if dep_zip.found()
vfs_src += files(
'zipfile.c',
'zippath.c',

View file

@ -3,3 +3,6 @@ directory=SPIRV-Cross
url=https://github.com/taisei-project/SPIRV-Cross.git
push-url=git@github.com:taisei-project/SPIRV-Cross.git
revision=meson-2021.01.15
[provide]
spirv-cross-c-shared=spirv_cross_dep

View file

@ -3,3 +3,6 @@ directory=cglm
url=https://github.com/taisei-project/cglm.git
push-url=git@github.com:taisei-project/cglm.git
revision=taisei-0.8.0
[provide]
cglm=cglm_dep

View file

@ -3,3 +3,6 @@ directory=freetype
url=https://github.com/taisei-project/freetype2.git
push-url=git@github.com:taisei-project/freetype2.git
revision=meson-2.10.1
[provide]
freetype2=freetype_dep

View file

@ -3,3 +3,6 @@ directory=libpng
url=https://github.com/taisei-project/libpng.git
push-url=git@github.com:taisei-project/libpng.git
revision=meson-1.6.37
[provide]
libpng=png_dep

View file

@ -3,3 +3,7 @@ directory=libwebp
url=https://github.com/taisei-project/libwebp.git
push-url=git@github.com:taisei-project/libwebp.git
revision=meson-1.2.0
[provide]
libwebp=webpdecoder_dep
libwebpdecoder=webpdecoder_dep

View file

@ -3,3 +3,6 @@ directory=libzip
url=https://github.com/taisei-project/libzip.git
push-url=git@github.com:taisei-project/libzip.git
revision=meson-1.7.3.142
[provide]
libzip=libzip_dep

View file

@ -3,3 +3,6 @@ directory=opusfile
url=https://github.com/taisei-project/opusfile.git
push-url=git@github.com:taisei-project/opusfile.git
revision=meson-0.12
[provide]
opusfile=opusfile_dep

View file

@ -3,3 +3,6 @@ directory=sdl2
url=https://github.com/taisei-project/SDL.git
push-url=git@github.com:taisei-project/SDL.git
revision=meson-2.0.20
[provide]
sdl2=sdl2_dep

View file

@ -3,3 +3,6 @@ directory=shaderc
url=https://github.com/taisei-project/shaderc.git
push-url=git@github.com:taisei-project/shaderc.git
revision=meson-2020.5
[provide]
shaderc=shaderc_dep

View file

@ -3,3 +3,6 @@ directory=zlib
url=https://github.com/taisei-project/zlib.git
push-url=git@github.com:taisei-project/zlib.git
revision=meson-1.2.11
[provide]
zlib=zlib_dep

View file

@ -33,15 +33,13 @@ pkgconfig = '$(bin_path pkg-config)'
elf2nro = '$(which elf2nro)'
nacptool = '$(which nacptool)'
[project options]
deprecation_warnings = 'no-error'
[built-in options]
c_args = [$(meson_arg_list $CPPFLAGS $CFLAGS)]
c_link_args = [$(meson_arg_list $LDFLAGS $LIBS $ADDITIONAL_LINK_FLAGS)]
cpp_args = [$(meson_arg_list $CPPFLAGS $CXXFLAGS)]
cpp_link_args = [$(meson_arg_list $LDFLAGS $LIBS $ADDITIONAL_LINK_FLAGS)]
werror = false
prefer_static = true
[host_machine]
system = 'nx'