mirror of
https://github.com/bkaradzic/bx.git
synced 2026-06-08 03:03:48 +00:00
4eb6f8ebb23daabb6c77c396fd276ca2029a7041
emscripten <= 4.0.23 only defined the lowercase forms (`__EMSCRIPTEN_major__`, `__EMSCRIPTEN_minor__`, `__EMSCRIPTEN_tiny__`) in `<emscripten/version.h>`. Starting with 4.0.24 (PR emscripten-core/emscripten#26180), uppercase became primary and lowercase was kept as deprecated aliases. bx PR #374 switched all references to the uppercase form, which is the right forward-looking direction — but it leaves users on emsdk <= 4.0.23 unable to build, because `__EMSCRIPTEN_MAJOR__` is undefined there and the preprocessor expression `(__EMSCRIPTEN_MAJOR__ * 10000 + …)` evaluates to 0. That tanks `BX_PLATFORM_EMSCRIPTEN`, which tanks `BX_PLATFORM_POSIX`, which makes `bx/src/os.cpp` skip its `<time.h>` / `<sched.h>` includes, which causes the build to fail on `unknown type name 'timespec'`. Add a small bridge: if the uppercase macros aren't defined but the lowercase ones are, alias the uppercase forms to lowercase. The rest of bx continues to use uppercase uniformly. Newer emsdk versions are unaffected (the bridge block is skipped because uppercase is already defined). Co-authored-by: Shuang Liu <[email protected]>
bx
Base X-platform library.
Goals:
- Provide OS/runtime/compiler independent core functionality to be able to write cross-platform applications.
- Compile without C Runtime (CRT) and without C++ Standard Library (STL).
Contact
Project page
https://github.com/bkaradzic/bx
License (BSD 2-clause)
Copyright 2010-2026 Branimir Karadzic
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. 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.
Description
Languages
C++
92.7%
C
5%
Lua
2.3%