Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,22 @@ jobs:
run: |
nix develop -c cmake -B build -G Ninja
nix develop -c cmake --build build

build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: 0.15.2

- name: Setup Ninja
uses: seanmiddleditch/gha-setup-ninja@7e868db0f3406270dd46e1dac26c65f621456723 # master

- name: Build
run: |
cmake -B build -G Ninja
cmake --build build
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,18 @@ target_compile_features(${PROJECT_NAME} PRIVATE c_std_11)
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_BINARY_DIR}")
target_link_libraries(${PROJECT_NAME} raylib ghostty-vt)

# Build as a GUI subsystem app on Windows so we don't get a console window.
# Without this, the child shell inherits our console and writes there instead
# of through the ConPTY pipe. We keep main() as the entry point.
if(WIN32)
set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE TRUE)
# MSVC/Clang need an explicit entry point override to keep main() as the
# entry point in a GUI subsystem app. MinGW handles this automatically.
if(MSVC OR (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT MINGW))
target_link_options(${PROJECT_NAME} PRIVATE "LINKER:/ENTRY:mainCRTStartup")
endif()
endif()

# macOS requires these system frameworks for raylib's windowing/input/rendering.
if (APPLE)
target_link_libraries(${PROJECT_NAME} "-framework IOKit")
Expand All @@ -67,3 +79,7 @@ endif()
if (UNIX AND NOT APPLE)
target_link_libraries(${PROJECT_NAME} util)
endif()

# Windows: ConPTY APIs (used for terminal emulation) are provided by kernel32.lib,
# which is linked implicitly by default on all Windows compilers (MSVC, MinGW-w64, Clang).
# No explicit target_link_libraries() call is needed for Windows.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ Ghostling is a demo project meant to highlight a minimum
functional terminal built on the libghostty C API in a
[single C file](https://github.com/ghostty-org/ghostling/blob/main/main.c).

The example uses Raylib for windowing and rendering. It is single-threaded
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the threading detail because with windows technically this is an incorrect statement since we have two threads. Happy to revert as needed

(although libghostty-vt supports threading) and uses a 2D graphics renderer
The example uses Raylib for windowing and rendering. It uses a 2D graphics renderer
instead of a direct GPU renderer like the primary [Ghostty](https://ghostty.org) GUI. This is to
showcase the flexibility of libghostty and how it can be used in a variety of
contexts.
Expand Down Expand Up @@ -64,11 +63,6 @@ These features aren't properly exposed by libghostty-vt yet but will be:
- OSC clipboard support
- OSC title setting

These are things that could work but haven't been tested or aren't
implemented in Ghostling itself:

- Windows support (libghostty-vt supports Windows)

This list is incomplete and we'll add things as we find them.

### What You Won't Ever Get
Expand Down Expand Up @@ -113,9 +107,14 @@ Requirements:
```sh
cmake -B build -G Ninja
cmake --build build
./build/ghostling
./build/ghostling # Linux / macOS
.\build\ghostling.exe # Windows
```

On Windows, ghostling uses ConPTY and auto-detects the best available
shell (pwsh > powershell > cmd). Pass a shell path as the first argument
to override (e.g. `ghostling.exe C:\Windows\System32\cmd.exe`).

> [!WARNING]
>
> Debug builds are VERY SLOW since Ghostty included a lot of extra
Expand Down
Loading