Skip to content

Introduce Linux platform and prepare for compiling chomp on Linux#11

Merged
benstone merged 25 commits into
benstone:mainfrom
mcayland:feature/linux-platform-part2
Nov 21, 2025
Merged

Introduce Linux platform and prepare for compiling chomp on Linux#11
benstone merged 25 commits into
benstone:mainfrom
mcayland:feature/linux-platform-part2

Conversation

@mcayland
Copy link
Copy Markdown
Contributor

@mcayland mcayland commented Nov 17, 2025

Now we can start to introduce the concept of a Linux platform (platlinux.cpp) and begin building the core low-level static kauai libraries.

With this series applied it is possible to build the KauaiChcm target in cmake on Linux using gcc, which is a significant step towards getting chomp (the chunk compiler) running to build the .chk data files used by 3DMMEx.

Comment thread kauai/src/base.cpp Outdated
Comment thread kauai/src/memposix.cpp Outdated
Comment thread kauai/src/platform.h Outdated
Comment thread kauai/src/utilstr.cpp Outdated
Comment thread kauai/src/utilstr.cpp Outdated
For platforms that are not (Classic) Mac, use the same behaviour as for the
Windows platform.
For platforms that are not (Classic) Mac, use the same behaviour as for the
Windows platform.
For non-Windows platforms declare Debugger() as extern so that a per-platform
implementation can be used instead.
When attempting to compile kauai/src/base.cpp GCC issues the following warning:

kauai/src/base.cpp: In static member function ‘static void BASE::operator delete(void*)’:
kauai/src/base.cpp:279:15: warning: deleting ‘void*’ is undefined [-Wdelete-incomplete]
  279 |     ::delete (pv);

Instead of calling delete on the void pointer which is an incomplete type, use malloc()
and free() in a similar way to Windows. Note that we also set the newly allocated memory
to zero to match the behaviour of the GMEM_ZEROINIT flag on Windows.
Use separate #ifdefs as required for each platform.
For platforms that are not (Classic) Mac, use the same behaviour as for the
Windows platform.
…() and LowerRgchs()

The native C implementation can be used for platforms that are not (Classic) Mac
or Windows.
…orms

With the latest changes it is now possible to use the memwin.cpp implementation
for both Windows and non-Classic Mac platform implementations. Add an explicit
entry for Linux in kauai/CMakeLists.txt so it is included when trying to build
on Linux.
This file provides a Linux platform implementation.
Ensure the header can be included when KAUAI_SDL is defined but WIN is undefined.
…orms

There is no default picture format on Linux, so provided a dummy typedef
as a placeholder.
This function is intended to create a new GPT for a Windows device context
but is unused except for in the portfolio on Windows.
The gfx region code is currently unused and so this is not required for non-Windows
builds.
…ic) Mac platforms

On Windows a HCTL represents an underlying HWND, so use our own KWND as an
alternative instead.
For platforms that are not (Classic) Mac, use the same behaviour as for the
Windows platform.
The _hnExport variable is of type HN (HANDLE) which is only used on Windows
platforms.
For platforms that are not (Classic) Mac, use the same behaviour as for the
Windows platform. Also define the CF_TEXT and CF_UNICODETEXT constants for
non-Windows platforms which are listed in the online Windows API
documentation.
For platforms that are not (Classic) Mac, use the same behaviour as for the
Windows platform.
…atforms

These stubs replace the existing CSAPI-based implementation for non-Windows and
non-Classic Mac platforms.
The _luVolSys variable is of type DWORD which is only used on Windows
platforms.
For platforms that are not (Classic) Mac, use the same behaviour as for the
Windows platform.
The byte order of the chunk data is dependent upon the endian of the
architecture as opposed to the platform.
For platforms that are not (Classic) Mac, use the same behaviour as for the
Windows platform.
The byte order of the chunk data is dependent upon the endian of the
architecture as opposed to the platform.
@mcayland mcayland force-pushed the feature/linux-platform-part2 branch from 27985de to 6a3ad75 Compare November 21, 2025 21:52
@mcayland mcayland changed the title Introduce Linux platform, POSIX memory routines, and preparation for compiling chomp on Linux Introduce Linux platform and prepare for compiling chomp on Linux Nov 21, 2025
@benstone benstone merged commit f505964 into benstone:main Nov 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants