Skip to content

Build kauai and chomp on Linux, allowing release .chk files identical to those on Windows to be built#12

Merged
benstone merged 29 commits into
benstone:mainfrom
mcayland:feature/linux-platform-part3
Nov 22, 2025
Merged

Build kauai and chomp on Linux, allowing release .chk files identical to those on Windows to be built#12
benstone merged 29 commits into
benstone:mainfrom
mcayland:feature/linux-platform-part3

Conversation

@mcayland
Copy link
Copy Markdown
Contributor

This series finishes the changes required to build kauai on Linux, followed by fixing up the chunk compiler chomp so that it is possible to build release .chk files identical to those on Windows via the studio-chomp-chunks target.

In particular this requires the addition of new fniposix.cpp and fileposix.cpp implementations written using C++17 std::filesystem that can be used for POSIX systems. The rest of the changes are fairly straightforward, however it is worth noting the changes to kauai/src/lex.cpp to include support for parsing pre-processor files generated from gcc which is needed to track source file position in the chunk compiler.

Comment thread kauai/CMakeLists.txt Outdated
Comment thread kauai/src/appb.cpp Outdated
Comment thread kauai/src/gob.cpp Outdated
Comment thread kauai/src/gob.cpp
Comment thread kauai/tools/chomp.cpp Outdated
Comment thread kauai/CMakeLists.txt
This allows the main() function to be compiled on both Windows and non-Windows
platforms.
This also requires the relevant callers to be updated because the cast logic
in the KWND class requires nullptr if the owner is unspecified.
…on-Windows platforms

This includes an implementation for platlinux.cpp.
This is a new FNI implementation for POSIX systems making use of the C++17
std::filesystem library which we include when building on Linux.
This is a new file implementation for POSIX systems which we include when
building on Linux.
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 except without generating the OutputDebugString() output.
For platforms that are not (Classic) Mac, use the same behaviour as for the
Windows platform.
…SWMEVENT

For now ignore any SDL_SYSWMEVENTs on non-Windows platforms.
This function is used by the Windows-specific portfolio code and is not used
on non-Windows platforms.
The HDC variable is unused and so can simply be removed.
Replace the Windows-specific byte type with the cstdint standard uint8_t type.
Replace the Windows-specific BOOL type with the cstdint standard bool type.
Thw Windows-specific _hnExport variable is not used on non-Windows platforms.
Also update kauai/CMakeLists.txt so that ctl.cpp is built for all platforms.
This is currently a set of stubs to allow the file to compile since there is no
native metafile format for POSIX systems. Update kauai/CMakeLists.txt so that
the file is used when building on non-Windows platforms.
This allows the khello app to compile and link on Linux.
…s target

GCC must be invoked using different flags in order to generate pre-processor output.
The existing options parser doesn't work correctly if filenames begin with a
forward slash since it is assumed that anything following the forward slash
will always be a command line option.

Adjust the parser so that only arguments that begin with a forward slash and
have a length of 2 characters are considered to be command line options.
…tforms

The native C implementation can be used for platforms that are not (Classic) Mac
or Windows.
For platforms that are not (Classic) Mac, use the same behaviour as for the
Windows platform.
…or non-Windows platforms

Use the definitions from the MIT-licensed libBMpp https://github.com/veeso/libBMpp/
and information from Wikipedia as a basis to provide an alternative to Windows in-built
definitions.
When attempting to parse whitespace within the input file, ensure that the line ending
is detected correctly on both Windows and non-Windows platforms.
… input file

When processing an input file, lex.cpp uses the embedded pre-processor source
file information to track the current file and line position. The MSVC
pre-processor generates source file information in the form "#line <num>
<filename>" whilst the gcc pre-processor generates source file information in
the form "# <n> <filename> <flags>".

Adjust LEXB::_FSkipWhiteSpace() so that it can handle both MSVC and gcc
embedded pre-processor source file information.
@mcayland mcayland force-pushed the feature/linux-platform-part3 branch from a8a1352 to 9ba681d Compare November 22, 2025 22:49
@benstone benstone merged commit 68d310f into benstone:main Nov 22, 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