Add support for MS-DOS build
Describe the problem you are trying to solve. I would like to have an officially supported build for MS-DOS targets (using DJGPP). Currently, I need to perform a little handstand with the custom build flags to get it working.
This is the current CMake file as per this commit:
FetchContent_Declare(
flecs
GIT_REPOSITORY https://github.com/SanderMertens/flecs.git
# Matching v4.1.6
GIT_TAG fb55f3c25660425cfe1bc4cf5e6bff8b3f18a9b8
EXCLUDE_FROM_ALL
)
SET(FLECS_SHARED OFF CACHE BOOL "Disabled shared libraries" FORCE)
FetchContent_MakeAvailable(flecs)
target_compile_definitions(flecs_static
PUBLIC
FLECS_CUSTOM_BUILD
FLECS_APP
# FLECS_LOG disabled until bug about mismatching log types is fixed about mismatching function signatures
FLECS_MODULE
FLECS_NO_OS_API_IMPL # to force os_api_impl to not include anything, due to it getting re-enabled
__COSMOCC__ # to force os_api.c to assume execinfo is not available
FLECS_SYSTEM
FLECS_STATS
FLECS_TIMER
)
if (DOS)
target_compile_definitions(flecs_static PUBLIC ECS_TARGET_FREEBSD) # to force os_api.h to include stdlib.h
endif ()FLECS_LOGis currently disabled due to bug #2270- Despite the documentation about
FLECS_CUSTOM_BUILDto disable everything by default, I had to explicitly defineFLECS_NO_OS_API_IMPLasFLECS_OS_API_IMPgot auto-enabled somewhere __COSMOCC__is a hack to forceHAVE_EXECINFOto be 0 -#include <execinfo.h>fails otherwise.ECS_TARGET_FREEBSDis another hack, because the default#include <alloca.h>fails inos_api.h, and trying to defineECS_TARGET_WINDOWS(which may be considered similar to MS-DOS) fails with other includes.
I did not try all the addons, I already curated the list a bit for the needs of my project. Things like threading and socket things had to be disabled outright, due to not being available on that platform.
Describe the solution you'd like
- Clarification on the
FLECS_(NO)_OS_API_IMPLbehaviour whenFLECS_CUSTOM_BUILDis defined - No hacks needed to get an MS-DOS build working
(Point 0 in this list is probably: Decide whether MS-DOS builds are going to be officially supported. Given the "recently" added support by SDL3 it is a fun property - also the main reason why I started doing that in my hobby project.)
Source: SanderMertens/flecs