Skip to content
Merged
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
84 changes: 84 additions & 0 deletions .github/workflows/linux-native-cairo-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Linux native Cairo build

on:
push:
branches: [master]
pull_request:
workflow_dispatch:

permissions:
contents: read

concurrency:
group: linux-cairo-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-test:
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
Comment thread
Ltabsyy marked this conversation as resolved.

- name: Install native dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends \
build-essential cmake ninja-build pkg-config \
libcairo2-dev libx11-dev xvfb

- name: Configure
run: >-
cmake -S . -B build -G Ninja
-DCMAKE_BUILD_TYPE=Release
-DEGE_DEFAULT_BACKEND=CAIRO
-DEGE_BUILD_DEMO=ON
-DEGE_BUILD_TEMP=OFF
-DEGE_BUILD_TEST=ON
-DEGE_ENABLE_WINDOW_TESTS=ON
-DEGE_ENABLE_CAMERA_TESTS=ON
-DEGE_ENABLE_CAMERA_CAPTURE=ON

- name: Build
run: cmake --build build --parallel 2

- name: Build all portable demos
run: |
cmake --build build --target demos --parallel 2
test -x build/demo/camera_base
test -x build/demo/camera_wave

- name: Build ccap tests and CLI
run: |
cmake -S 3rdparty/ccap -B build/ccap-tests -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCCAP_BUILD_CLI=ON \
-DCCAP_BUILD_TESTS=ON \
-DCCAP_BUILD_EXAMPLES=OFF \
-DCCAP_ENABLE_FILE_PLAYBACK=OFF \
-DCCAP_ENABLE_VIDEO_WRITER=OFF
cmake --build build/ccap-tests --parallel 2

- name: Test ccap, headless rendering and X11 integration
run: |
sudo install -m 666 /dev/null /dev/video99
trap 'sudo unlink /dev/video99' EXIT
export EGE_TEST_V4L2_PATH=/dev/video99
export LD_PRELOAD="$PWD/build/tests/native/libege_native_fake_v4l2.so"
ctest --test-dir build/ccap-tests --output-on-failure
unset LD_PRELOAD
xvfb-run -a ctest --test-dir build --output-on-failure

- name: Enforce lightweight GUI dependency boundary
shell: bash
run: |
dependencies="$(ldd build/tests/native/ege_native_linux_window_smoke)"
echo "$dependencies"
if grep -Eiq 'lib(Qt|gtk|gdk|wx|SDL|glfw|webkit|electron|pango)' <<<"$dependencies"; then
echo "Unexpected GUI framework dependency detected" >&2
exit 1
fi
test -s build/libgraphics.a
size -t build/libgraphics.a | tail -1
53 changes: 43 additions & 10 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# EGE 编译指南

EGE 源码使用 CMake 3.13 或更高版本构建。Windows 默认使用 GDI;macOS 现在可用
EGE 源码使用 CMake 3.13 或更高版本构建。Windows 默认使用 GDI;macOS 可用
AppleClang 直接生成 Mach-O 原生程序,默认绘制后端为 Core Graphics,窗口后端为
AppKit。macOS 原生构建不需要 MinGW、Wine 或 OpenGL。
AppKit;Linux 默认使用 Cairo 绘制与 Xlib 窗口。原生构建不需要 MinGW、Wine 或 OpenGL。

EGE 的可选子模块由 Git submodule 管理。CMake 配置阶段不会访问网络或修改
源码目录。默认关闭 camera 时不需要拉取 `ccap`;如果需要 camera,请在配置前执行:
Expand All @@ -12,8 +12,37 @@ git submodule update --init --recursive 3rdparty/ccap
```

请安装 CMake 和目标平台的原生编译器。macOS 使用 Xcode Command Line Tools;Windows
使用 MSVC 或 MinGW-w64。Linux 主机仍可通过显式 toolchain 交叉编译 Windows 版,但
Linux 原生 Cairo 后端尚未实现,配置会 fail-fast,不会默认生成依赖 Wine 的 `.exe`。
使用 MSVC 或 MinGW-w64;Linux 使用 GCC/Clang、Cairo 与 X11 开发包。Linux 主机仍可
通过显式 toolchain 交叉编译 Windows 版,但默认会生成原生 ELF。

## Linux 原生 Cairo/Xlib 构建

Debian/Ubuntu 安装依赖并构建:

```sh
sudo apt-get install build-essential cmake ninja-build pkg-config libcairo2-dev libx11-dev
cmake -S . -B build/native-cairo -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DEGE_DEFAULT_BACKEND=CAIRO \
-DEGE_ENABLE_OPENGL=OFF \
-DEGE_ENABLE_CAMERA_CAPTURE=OFF \
-DEGE_BUILD_TEST=ON \
-DEGE_BUILD_DEMO=ON \
-DEGE_BUILD_TEMP=OFF
cmake --build build/native-cairo --parallel
cmake --build build/native-cairo --target demos --parallel
ctest --test-dir build/native-cairo --output-on-failure
```

窗口集成测试额外需要 `xvfb`,配置时加入
`-DEGE_ENABLE_WINDOW_TESTS=ON`,再运行
`xvfb-run -a ctest --test-dir build/native-cairo --output-on-failure`。
Comment thread
Ltabsyy marked this conversation as resolved.
完整 Linux CI 验收还会递归检出 `ccap`,设置
`-DEGE_ENABLE_CAMERA_CAPTURE=ON -DEGE_ENABLE_CAMERA_TESTS=ON`,并使用测试专用的
用户态 V4L2 仿真器运行相机枚举、格式协商、mmap streaming、YUYV→BGRA 和
`CameraFrame`/`IMAGE` 像素测试。仿真器不进入正式库,也不新增运行时依赖。
默认只直接链接系统 `libcairo` 和 `libX11`,不链接 GTK、wxWidgets、SDL 或 Pango。
更详细的设计与依赖取舍见 [Linux native backend](docs/linux-native-backend.md)。

## macOS 原生 Core Graphics 构建

Expand Down Expand Up @@ -67,6 +96,9 @@ bash tasks.sh --debug --show-config
脚本会拒绝删除仓库根目录或无法确认属于本项目的自定义目录,
但调用前仍应检查 `--show-config` 输出。

Linux 上同一脚本会显式选择 `CAIRO`,使用 `build/linux/Debug` 或
`build/linux/Release`,`--run` 直接启动无扩展名 ELF,不再追加 `.exe` 或调用 Wine。

`utils/release.sh` 在 macOS 上生成的 AppleClang 静态库位于
`Release/lib/macOS`。脚本分别构建 arm64/x86_64,用 `lipo` 合成 universal
archive,检查每个 slice 的 macOS 11.0 标记,并使用与官方包相同的
Expand All @@ -89,14 +121,15 @@ Windows 专用的 `utils/release-msvc.sh`、`utils/release-mingw.sh` 和
`utils/release.sh` 的 macOS 路径也不清理工作树,并可用上述环境变量完全隔离输出。

`utils/test-run-demos.sh --directory <demo-build-dir>` 可在交互式桌面会话中启动
已构建 demo:macOS 直接运行 Mach-O,Linux 对 Windows `.exe` 明确使用 Wine。
已构建 demo:macOS 直接运行 Mach-O,Linux 优先直接运行原生 ELF;目录中只有
Windows `.exe` 时才明确使用 Wine。
camera demo 默认排除,只有显式传 `--include-camera` 才会触发其权限/设备路径。

### 逐像素 CPU buffer 语义

macOS 后端以 CPU `PixelSurface` 作为图像像素的权威存储。`getbuffer()` 返回可直接
macOS 与 Linux 后端都以 CPU `PixelSurface` 作为图像像素的权威存储。`getbuffer()` 返回可直接
读写的、从上到下排列的连续像素:每行是 `width * sizeof(color_t)` 字节,在小端
macOS 上数值表示为 `0xAARRGGBB`,内存字节顺序为预乘 Alpha 的 BGRA。Core Graphics
平台上数值表示为 `0xAARRGGBB`,内存字节顺序为预乘 Alpha 的 BGRA。Core Graphics/Cairo
直接绘制到同一块 CPU buffer,所以常规逐像素读写不发生 GPU readback 或 CPU/GPU
双向同步。指针在对应 `IMAGE` 不重建、不缩放且不销毁期间有效。

Expand Down Expand Up @@ -134,9 +167,9 @@ sudo apt-get install mingw-w64 wine
sudo pacman -S mingw-w64 wine
```

Linux 原生后端尚未完成,因此 Linux 发布和 CI 继续通过
`cmake/toolchains/mingw-w64.cmake` 显式生成 Windows 静态库及 `.exe`。macOS
不再支持或发布这条交叉编译路径。
Linux 默认构建原生 Cairo/Xlib 后端。只有明确传入
`-DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/mingw-w64.cmake` 时才生成 Windows
静态库及 `.exe`。macOS 不再支持或发布这条交叉编译路径。

## 基本编译步骤

Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ if(EGE_CLEAR_OPTIONS_CACHE AND EGE_IS_ROOT_PROJECT)
EGE_BUILD_DEMO
EGE_BUILD_TEST
EGE_ENABLE_WINDOW_TESTS
EGE_ENABLE_CAMERA_TESTS
EGE_BUILD_TEMP
EGE_DEFAULT_BACKEND
EGE_ENABLE_OPENGL
Expand All @@ -52,6 +53,8 @@ option(EGE_BUILD_DEMO "Build EGE demos" ${EGE_IS_ROOT_PROJECT})
option(EGE_BUILD_TEST "Build EGE tests" ${EGE_IS_ROOT_PROJECT})
option(EGE_ENABLE_WINDOW_TESTS
"Register tests that create visible native windows (never enabled by default)" OFF)
option(EGE_ENABLE_CAMERA_TESTS
"Register tests that exercise a virtual native camera (never enabled by default)" OFF)
option(EGE_BUILD_TEMP "Build EGE temporary programs" ${EGE_IS_ROOT_PROJECT})

if(NOT DEFINED EGE_DISABLE_DEBUG_INFO)
Expand Down
33 changes: 23 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
[![MinGW Windows Build](https://github.com/x-ege/xege/actions/workflows/mingw-windows-build.yml/badge.svg)](https://github.com/x-ege/xege/actions/workflows/mingw-windows-build.yml)
[![MinGW Linux Cross-Compile Build](https://github.com/x-ege/xege/actions/workflows/mingw-crosscompile-build.yml/badge.svg)](https://github.com/x-ege/xege/actions/workflows/mingw-crosscompile-build.yml)
[![macOS Native CoreGraphics Build](https://github.com/x-ege/xege/actions/workflows/macos-native-coregraphics-build.yml/badge.svg)](https://github.com/x-ege/xege/actions/workflows/macos-native-coregraphics-build.yml)
[![Linux Native Cairo Build](https://github.com/x-ege/xege/actions/workflows/linux-native-cairo-build.yml/badge.svg)](https://github.com/x-ege/xege/actions/workflows/linux-native-cairo-build.yml)
[![License](https://img.shields.io/badge/license-LGPL--2.1-blue.svg)](LICENSE)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS-lightgrey.svg)](https://github.com/x-ege/xege)
[![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey.svg)](https://github.com/x-ege/xege)

EGE (Easy Graphics Engine) 是一个提供类似 BGI (`graphics.h`) 接口的简易绘图库,
支持 Windows GDImacOS Core Graphics/AppKit 原生后端,专为 C/C++ 初学者设计。
支持 Windows GDImacOS Core Graphics/AppKit 和 Linux Cairo/Xlib 原生后端,专为 C/C++ 初学者设计。

> 原生 macOS 支持已合入 `master`,将在下一个正式 SDK 发布;
> 已发布的 v25.11 不包含这个后端。当前可从源码构建或使用 CI 预览制品。
Expand Down Expand Up @@ -64,6 +65,7 @@ EGE 支持以下 开发工具/编译器:
| Code::Blocks | 支持 | 已测试版本: 25.03 (最新) |
| MinGW / MinGW-w64 | 支持 | ✅ 支持, SDK 发布时会基于最新版本进行测试 |
| AppleClang / Xcode Command Line Tools | macOS | ✅ Core Graphics + AppKit 原生 Mach-O 构建,不需要 Wine |
| GCC / Clang | Linux | ✅ Cairo + Xlib 原生 ELF 构建;Wayland 会话通过 XWayland 运行 |
| 老版本 Visual Studio | 2010 ~ 2015 | ⚠️ 支持,但不推荐(不支持 C++17) |
| Visual C++ 6.0 | aka vc6.0 | ⚠️ 旧版支持,可从[官网](https://xege.org/install_and_config)下载内嵌版本 |
| Dev-C++ | 支持 | ⚠️ 十年未更新, 不那么推荐 </br> 已测试版本: 5.11 (最新) |
Expand All @@ -75,9 +77,9 @@ EGE 支持以下 开发工具/编译器:
|------|----------|------|
| Windows | 稳定 | GDI/GDI+ 后端,保留 HWND/HDC、资源和 `sys_edit` 等 Win32 能力 |
| macOS 11.0+ | `master` 预览 | Core Graphics/AppKit 原生后端,支持 arm64/x86_64;`MUSIC` 使用 AVFAudio |
| Linux 原生 | 未实现 | Cairo 后端尚未完成;Linux CI 当前是 MinGW Windows 交叉编译 |
| Linux 原生 | `master` 预览 | Cairo/Xlib CPU 后端;只直接依赖系统 `libcairo` 与 `libX11`,Wayland 通过 XWayland |

macOS 上的 Win32 句柄/资源接口(如 `attachHWND`、`seticon(int)`、
macOS/Linux 上的 Win32 句柄/资源接口(如 `attachHWND`、`seticon(int)`、
`getHDC`)只保留源码兼容签名,不等价于 Windows 资源模型;`sys_edit`
仍仅在 Windows 实现。`graph_star` 是 Win32 屏保 demo,不在 macOS 构建。
摄像头 demo 首次运行时会请求系统权限。
Expand Down Expand Up @@ -131,10 +133,10 @@ EGE 提供官方 IDE 插件,让项目配置更加简单:

| 特点 | 说明 |
|------|------|
| 零依赖轻量级 | 使用 `stb_image` 和 `sdefl/sinfl` 替代 `libpng`/`zlib`,无外部依赖,单库即可使用 |
| 直接像素访问 | `getbuffer` 返回 CPU 权威的顶向下、连续预乘 BGRA 像素;macOS Core Graphics 直接复用该 buffer,无 GPU readback |
| 抗锯齿支持 | Windows 使用 GDI+;macOS Core Graphics 后端与 `ege_enable_aa` 共享抗锯齿状态 |
| 预乘 Alpha 优化 | 默认使用 PRGB32;Windows 可调用 `AlphaBlend`,macOS 在 CPU PixelSurface 上混合并由 Core Graphics 呈现 |
| 轻量依赖 | 图片编解码使用内置 `stb_image` 和 `sdefl/sinfl`;Linux 只链接系统 Cairo/X11,不引入 GUI 框架 |
| 直接像素访问 | `getbuffer` 返回 CPU 权威的顶向下、连续预乘 BGRA 像素;Core Graphics/Cairo 直接复用该 buffer,无 GPU readback |
| 抗锯齿支持 | Windows 使用 GDI+;macOS Core Graphics 与 Linux Cairo 后端共享 `ege_enable_aa` 状态 |
| 预乘 Alpha 优化 | 默认使用 PRGB32;Windows 可调用 `AlphaBlend`,macOS/Linux 在 CPU PixelSurface 上混合后原生呈现 |
| 多图像格式支持 | 支持 PNG, JPEG, BMP, GIF, TGA, PSD, HDR 等常见图像格式 |
| 灵活的图像操作 | 支持图像旋转、缩放、透明贴图、Alpha 滤镜等高级变换 |
| 坐标变换系统 | 提供 `ege_transform_*` 系列函数,支持平移、旋转、缩放等矩阵变换 |
Expand Down Expand Up @@ -162,8 +164,19 @@ cmake --build build/native --target xege
`11.0` 是当前原生库的最低支持版本;可以显式设置更高值,
但发布制品和 CI 会固定在 11.0,避免继承构建机的最新 SDK 版本。

Linux 原生 Cairo 后端尚未实现,当前会在 CMake 配置阶段 fail-fast。OpenGL
实验分支只作为构建分层和后端接口参考,不默认启用。
Linux 原生最小构建为:

```sh
sudo apt-get install build-essential cmake pkg-config libcairo2-dev libx11-dev
cmake -S . -B build/linux \
-DEGE_DEFAULT_BACKEND=CAIRO \
-DEGE_ENABLE_OPENGL=OFF \
-DEGE_ENABLE_CAMERA_CAPTURE=OFF
cmake --build build/linux --target xege
```

实现边界、依赖与测试方法见 [Linux native backend](docs/linux-native-backend.md)。
OpenGL 实验分支只作为构建分层和后端接口参考,不默认启用。

## 社区与支持

Expand Down
20 changes: 13 additions & 7 deletions cmake/EgeBackends.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,28 @@ function(ege_configure_backend target)
"${EGE_CORETEXT_FRAMEWORK}"
"${EGE_IMAGEIO_FRAMEWORK}")
elseif(EGE_RESOLVED_BACKEND STREQUAL "CAIRO")
set(_ege_cairo_required_sources
src/backend/linux/CairoRenderTarget.cpp
src/backend/linux/LinuxWindow.cpp)
foreach(_ege_source IN LISTS _ege_cairo_required_sources)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_ege_source}")
message(FATAL_ERROR
"The Cairo backend is incomplete: missing ${_ege_source}")
endif()
endforeach()
_ege_add_existing_sources(${target} _ege_cairo_sources
src/backend/linux/CairoSurface.cpp
src/backend/linux/CairoRenderTarget.cpp
src/backend/linux/LinuxWindow.cpp
)
if(NOT _ege_cairo_sources)
message(FATAL_ERROR
"The Cairo backend is not implemented yet. Expected explicit "
"sources under src/backend/linux.")
endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(EGE_CAIRO REQUIRED IMPORTED_TARGET cairo)
pkg_check_modules(EGE_X11 REQUIRED IMPORTED_TARGET x11)
target_compile_definitions(${target} PRIVATE EGE_BACKEND_CAIRO=1)
target_include_directories(${target} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src/backend/linux")
target_link_libraries(${target} PRIVATE PkgConfig::EGE_CAIRO)
target_link_libraries(${target} PRIVATE
PkgConfig::EGE_CAIRO
PkgConfig::EGE_X11)
elseif(EGE_RESOLVED_BACKEND STREQUAL "OPENGL")
target_compile_definitions(${target} PRIVATE EGE_BACKEND_OPENGL=1)
endif()
Expand Down
18 changes: 11 additions & 7 deletions cmake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ macOS/Linux 不再自动切换为 Windows 交叉编译。
| --- | --- | --- |
| `EGE_BUILD_DEMO` | 根项目 ON | 生成 demo 目标 |
| `EGE_BUILD_TEST` | 根项目 ON | 注册目标平台的 CTest 套件 |
| `EGE_ENABLE_WINDOW_TESTS` | OFF | 注册会显示窗口的 macOS 测试;不应在 headless CI 开启 |
| `EGE_ENABLE_WINDOW_TESTS` | OFF | 注册真实窗口测试;Linux CI 可在 Xvfb 中开启 |
| `EGE_ENABLE_CAMERA_TESTS` | OFF | 注册 Linux 用户态虚拟 V4L2 相机测试;需要同时启用 camera capture |
| `EGE_BUILD_TEMP` | 根项目 ON | 构建 gitignored `temp/` 中的本地程序 |
| `EGE_DEFAULT_BACKEND` | `AUTO` | Windows→`GDI`,macOS→`COREGRAPHICS`Linux `CAIRO` 尚未实现 |
| `EGE_DEFAULT_BACKEND` | `AUTO` | Windows→`GDI`,macOS→`COREGRAPHICS`Linux`CAIRO` |
| `EGE_ENABLE_OPENGL` | OFF | 实验后端开关;当前源码不完整时 fail-fast |
| `EGE_ENABLE_CAMERA_CAPTURE` | 动态 | C++17 且 ccap 子模块完整时 ON,否则 OFF |
| `EGE_ENABLE_CPP17` | 编译器探测 | 启用 C++17 内部路径 |
Expand Down Expand Up @@ -43,19 +44,19 @@ file build/native-coregraphics/demo/graph_5star
`EGE_DEFAULT_BACKEND=AUTO` 的解析规则是:Windows 使用 `GDI`,macOS
使用 `COREGRAPHICS`,Linux 使用 `CAIRO`。也可以显式传入
`GDI|COREGRAPHICS|CAIRO|OPENGL`;平台与后端不兼容时,配置阶段会直接报错。
当前 Linux Cairo 实现源码尚未接入,因此 Linux 原生 `AUTO`/`CAIRO` 会明确
fail-fast;不会隐式改为 MinGW 并生成 `.exe`。
Linux `CAIRO` 后端使用系统 Cairo 与 Xlib,直接生成原生 ELF;不会隐式改为
MinGW 并生成 `.exe`。

OpenGL 不是原生构建的前提。只有明确传入 `-DEGE_ENABLE_OPENGL=ON` 时才会
查找 OpenGL 和 GLFW;把默认后端设为 `OPENGL` 时也必须同时启用该选项。
旧 OpenGL 分支只作为 CMake 分层与后端接口的参考;它不是默认后端,也不是
Core Graphics 构建依赖。当源码树没有 OpenGL 实现时,显式启用会 fail-fast。

## macOS 像素内存契约
## 原生像素内存契约

Core Graphics 后端将 CPU `PixelSurface` 作为权威像素存储。内存为顶向下、紧密排列
Core Graphics 与 Cairo 后端将 CPU `PixelSurface` 作为权威像素存储。内存为顶向下、紧密排列
的预乘 BGRA,小端数值为 `0xAARRGGBB`,stride 等于 `width * sizeof(color_t)`。
`getbuffer()` 直接返回这块 CPU 内存,Core Graphics 也直接绘制到同一块内存,因而
`getbuffer()` 直接返回这块 CPU 内存,原生渲染器也直接绘制到同一块内存,因而
逐像素读写不需要 GPU readback。在 `IMAGE` 重建、resize 或销毁后,应重新获取
指针。

Expand Down Expand Up @@ -84,3 +85,6 @@ git submodule update --init --recursive 3rdparty/ccap

未初始化 ccap 时,camera 默认关闭;如果显式设置
`EGE_ENABLE_CAMERA_CAPTURE=ON`,配置会给出可操作的错误信息。
Linux CI 还会设置 `EGE_ENABLE_CAMERA_TESTS=ON`,通过测试专用的用户态
V4L2 仿真器验证设备枚举、格式协商、流式抓帧和 `CameraFrame` 转换;该仿真器
只编译进测试目标,不进入 `libgraphics.a` 或发布包。
4 changes: 4 additions & 0 deletions demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ macro(ege_add_executable name source)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(CMAKE_HOST_UNIX)
target_compile_definitions(${name} PRIVATE _FORTIFY_SOURCE=0)
endif()
# The MinGW SDK demos are distributed as self-contained Windows binaries.
# Native Linux demos must remain dynamically linked to system Cairo/X11.
if(MINGW)
target_link_options(${name}
PRIVATE -static)
endif()
Expand Down
1 change: 1 addition & 0 deletions demo/camera_wave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <string>
#include <cassert>
#include <cmath>
#include <cstring>
#include <algorithm>

// 文本本地化宏定义
Expand Down
3 changes: 2 additions & 1 deletion demo/game_gomoku.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#include "graphics.h"
#include <cstdlib>
#include <vector>

/// 是否禁用音效. 如果存在编译问题, 可以把下面这行的值改成 0
Expand Down Expand Up @@ -734,4 +735,4 @@ int main()

closegraph();
return 0;
}
}
Loading
Loading