Skip to content

Commit

Permalink
Some documentation improvements: extra info on using GENie.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcourteaux committed Oct 5, 2024
1 parent 5700556 commit a89623f
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 18 deletions.
90 changes: 73 additions & 17 deletions docs/build.rst
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
Building
========

Dependencies
------------
Dependencies & Getting the source
---------------------------------

https://github.com/bkaradzic/bx
- https://github.com/bkaradzic/bx
- https://github.com/bkaradzic/bimg

https://github.com/bkaradzic/bimg

Getting Source
--------------
The directories for `bx`, `bimg`, and `bgfx` should all be siblings of each other.
So clone the repositories next to each other:

::

git clone https://github.com/bkaradzic/bx.git
git clone https://github.com/bkaradzic/bimg.git
git clone https://github.com/bkaradzic/bgfx.git

Quick Start
-----------
Quick Start for Windows
-----------------------

These are step for users who use Windows with Visual Studio.

Expand Down Expand Up @@ -84,17 +83,19 @@ Build

bgfx uses `GENie - Project generator tool <https://github.com/bkaradzic/genie#genie---project-generator-tool>`__
to generate project files for various platform. Binaries for Linux, macOS, and Windows are included in
bx repository.
bx repository. GENie can generate a useful list of options relevant to the project using the
``--help`` flag. Most platform-specific examples below do not explicitly use the ``genie`` executable, but a convenience
makefile instead. For more control, you can directly use ``genie`` to generate the project files.

General
~~~~~~~
General (Makefile wrapper)
~~~~~~~~~~~~~~~~~~~~~~~~~~

::

cd bgfx
make

After calling ``make``, .build/projects/\* directory will be generated.
After calling ``make``, ``.build/projects/\*`` directory will be generated.
All intermediate files generated by compiler will be inside .build
directory structure. Deleting .build directory at any time is safe.

Expand All @@ -108,6 +109,55 @@ Configuration is ``<platform>-<debug/release>[32/64]``. For example:

linux-release64, wasm-debug, wasm-release, osx-debug, osx-release, android-arm64-release, etc.


General (Directly with GENie)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Inspect the available options (where ``<platform>`` is ``linux``, ``windows``, or ``darwin``):
::

../bx/tools/bin/<platform>/genie --help

Select the options you want, such as:

- ``--with-tools``
- ``--with-amalgamated`` (see below)
- ``--with-shared-lib``
- ``--with-profiler`` (see https://bkaradzic.github.io/bgfx/bgfx.html#_CPPv4N4bgfx9CallbackIE)
- ``--with-examples`` (see https://bkaradzic.github.io/bgfx/examples.html)
- ``--with-sdl`` to use SDL2 for the examples.
- ``--with-glfw`` to use GLFW3 for the examples.

There are also many platform-specific options.

.. note::
If you wish to use the OpenGL backend, specifying a minimum API version is possible through setting
the ``BGFX_CONFIG`` environment variable when running ``genie``. For example:

::

# Unix:
export BGFX_CONFIG=RENDERER_OPENGL_MIN_VERSION=40
# Windows:
set BGFX_CONFIG=RENDERER_OPENGL_MIN_VERSION=40

../bx/tools/bin/<platform>/genie <... your options ...>

The same can be done for OpenGL ES.

Then generate your project files with the options.
Your project folder is in ``.build/projects/``.
For more help on specific platforms, see below and read the ``makefile`` in the bgfx repository) for examples on how to use GENie.

For gmake projects, specify compile using:

::

make config=<config> -C .build/projects/<platform>-gmake

Where ``<config>`` is something like ``release64``, ``debug64`` (or equivalent 32 bit), and
``<platform>`` is the platform you chose.

Windows
~~~~~~~

Expand All @@ -123,18 +173,20 @@ Visual Studio 2019 IDE:

start .build/projects/vs2019/bgfx.sln

Xcode
macOS
~~~~~

Xcode command line:
There are two options when working on macOS: Xcode command-line builds, or within the XCode graphical development environment.

For the Xcode command line:

::

make osx-release
cd examples/runtime
../../.build/osx64_clang/bin/examples.app/Contents/MacOS/examplesRelease

Xcode IDE:
Or for Xcode IDE:

::

Expand All @@ -157,17 +209,21 @@ Linux

make linux-release64

For more options, see `General (directly with GENie) <#general-directly-with-genie>`_.

WinRT / UWP
~~~~~~~~~~~

::

..\bx\tools\bin\windows\genie --vs=winstore100 vs2019

For more options, see `General (directly with GENie) <#general-directly-with-genie>`_.
Build the resulting solution and deploy to device.

.. note:: Shaders will need to be compiled with the appropriate target profile for your platform.


Amalgamated Build
-----------------

Expand Down Expand Up @@ -199,7 +255,7 @@ Alternative build systems
- https://github.com/yuki-koyama/hello-bgfx
- https://github.com/ataulien/bgfx-cmake

**fips** is a highlevel build system wrapper written in Python for C/C++ projects.
**fips** is a high-level build system wrapper written in Python for C/C++ projects.
https://github.com/floooh/fips#fips

**Conan** package
Expand Down
2 changes: 1 addition & 1 deletion docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Supported Platforms

- Android (14+)
- iOS/iPadOS/tvOS (16.0+)
- Linux
- Linux (both X11 and Wayland)
- macOS (13.0+)
- PlayStation 4
- RaspberryPi
Expand Down

0 comments on commit a89623f

Please sign in to comment.