dethrace/docs/PORTING.md

1.6 KiB

Porting Dethrace to other systems

Operating Systems

Assuming an operating system called foo, follow the steps to add support for it.

  1. Add a new file os/foo.h and implement the required functions defined in os.h:
  • OS_InstallSignalHandler
  • OS_fopen
  • OS_ConsoleReadPassword
  1. Update src/harness/CMakeLists.h and add a new conditional section for "os/foo.h", based on existing conditions for Windows, MacOS etc.

For example:

...
elseif( _FOO_ )
target_sources(harness PRIVATE
    os/foo.c
)
...

IO Platform (windowing / input / rendering)

A Platform in dethrace implements windowing, rendering and input handling.

The default platform is SDL_OpenGL, which uses SDL for windowing and input, and OpenGL for rendering. See platforms/sdl_opengl.c.

To add a new Platform:

  1. Create platforms/my_platform.c file and add a Harness_Platform_Init function. Hook up all the function pointers using the sdl_opengl implementation as a guide.

  2. Add a new conditional section in src/harness/CMakeLists.txt for your new platform

For example:

if (IO_PLATFORM STREQUAL "My_Platform")
    target_sources(harness PRIVATE
        io_platforms/my_platform.c
    )
endif()
  1. Run cmake to update your build with the new platform
cd build
cmake -DIO_PLATFORM=My_Platform ..
  1. Build
cmake --build .