It is recommended to compile the project with CMake preset and workflow.
- Visual Studio 2022 (17.14)
- Windows SDK 10.0.26100
- CMake 3.31
CMake configuration:
cmake --preset vs2022-amd64Build (Debug or Release profile):
cmake --build --preset windows-amd64-debug
cmake --build --preset windows-amd64-releaseRelease (configuration and build Release profile):
cmake --workflow --preset windows-amd64-releaseWARNING: Support for x86 32-bit version is deprecated
CMake configuration:
cmake --preset vs2022-x86Build (Debug or Release profile):
cmake --build --preset windows-x86-debug
cmake --build --preset windows-x86-releaseRelease (configuration and build Release profile):
cmake --workflow --preset windows-x86-releaseTODO: Waiting for me to get a Windows on arm laptop
Next, you can use Visual Studio 2022 to open the sln solution file and start developing.
Note: Please compile the LuaSTG target at least once, otherwise the header files of dependency libraries such as libflac, libogg, libvorbis, zlib ng, minizip ng, etc. do not exist.
If you need to use the Steam API, please follow these steps:
- Download the Steamworks SDK from the official Steamworks website
- Open the website: https://partner.steamgames.com/doc/sdk
- Login to your Steamworks account
- Download the latest version of the Steamworks SDK (as of November 11, 2025, the latest version is
1.62): https://partner.steamgames.com/downloads/list
- Extract the Steamworks SDK
- After downloading, you will receive a compressed file named
steamworks_sdk_xyy.zip, wherexyyrepresents the version number (as of November 11, 2025, the latest version number is162) - Open the ZIP archive using any software that supports
zipfiles; you will see ansdkfolder inside - Extract the
sdkfolder from the archive into directoryexternal/steam_api/SteamworksSDK
- After downloading, you will receive a compressed file named
- Enable Steam API in CMake
- Set the CMake option
LUASTG_STEAM_API_ENABLEtoTRUE - Set the CMake option
LUASTG_STEAM_API_APP_IDto your game’s AppID - To prevent players from launching the
exedirectly by double-clicking (which may cause Steam API initialization to fail), set the CMake optionLUASTG_STEAM_API_FORCE_LAUNCH_BY_STEAMtoTRUE
- Set the CMake option
- Re-run CMake configuration (CMake Configure)
To make it easier for developers, we provide a template file cmake/example/CMakeUserPresets.SteamAPI.json that can be used with just minor modifications:
- Copy the file
cmake/example/CMakeUserPresets.SteamAPI.jsonto the project root directory. - Rename the file to
CMakeUserPresets.json. - Modify the value of
LUASTG_STEAM_API_APP_ID. - Execute the command
cmake --workflow --preset windows-amd64-my-steam-api-releaseto run the CMake workflow.
If the template file does not meet your needs, you can modify it as needed.
建议通过 CMake 预配(preset)和工作流(workflow)编译项目。
- Visual Studio 2022 (17.14)
- Windows SDK 10.0.26100
- CMake 3.31
CMake 配置:
cmake --preset vs2022-amd64编译:
cmake --build --preset windows-amd64-debug
cmake --build --preset windows-amd64-release一键发行(CMake 配置、编译发行版):
cmake --workflow --preset windows-amd64-release警告:x86 32 位版本即将停止支持
CMake 配置:
cmake --preset vs2022-x86编译(调试版或发行版):
cmake --build --preset windows-x86-debug
cmake --build --preset windows-x86-release一键发行(CMake 配置、编译发行版):
cmake --workflow --preset windows-x86-release未完成:等我买一台 Windows on arm 笔记本
首先需要初始化环境,比如初始化为以下环境:
- Visual Studio 2026 Community v143 (MSVC 14.44)
- Windows SDK 10.0.26100
- AMD64 (x64)
那么对应的命令为:
"C:\Program Files\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 10.0.26100.0 -vcvars_ver=14.44接下来,执行 CMake 配置步骤,以 Debug 配置为例:
cmake -S . -B %cd%\build\amd64-ninja-debug -G Ninja -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DCMAKE_BUILD_TYPE=Debug -DCPM_SOURCE_CACHE=%cd%\build\packages最后,执行编译:
cmake --build %cd%\build\amd64-ninja-debug --target LuaSTG接下来你就可以用 Visual Studio 2022 打开 sln 解决方案开始开发。
注意:请编译 LuaSTG 项目至少一次,否则 libflac、libogg、libvorbis、zlib-ng、minizip-ng 等依赖库的头文件不存在。
如果你需要使用 Steam API,请遵循以下步骤:
- 从 Steamworks 官网下载 Steamworks SDK
- 打开网站:https://partner.steamgames.com/doc/sdk
- 登录你的 Steamworks 账号
- 下载最新版本的 Steamworks SDK(截至 2025 年 11 月 11 日,最新版本为
1.62):https://partner.steamgames.com/downloads/list
- 解压 Steamworks SDK
- 下载完成后会得到
steamworks_sdk_xyy.zip压缩包,其中xyy是版本号(截至 2025 年 11 月 11 日,最新版本号为162) - 用任意支持
zip压缩包的软件打开压缩包,可以看到压缩包中有一个sdk文件夹 - 将压缩包中的
sdk文件夹解压到external/steam_api/SteamworksSDK文件夹中
- 下载完成后会得到
- 在 CMake 中启用 Steam API
- 将 CMake 选项
LUASTG_STEAM_API_ENABLE设置为TRUE - 将 CMake 选项
LUASTG_STEAM_API_APP_ID修改为你的 AppID - 为了避免玩家直接双击
exe启动造成 Steam API 初始化失败,可以将 CMake 选项LUASTG_STEAM_API_FORCE_LAUNCH_BY_STEAM设置为TRUE
- 将 CMake 选项
- 重新运行一次 CMake 配置(CMake Configure)
为了方便开发者,我们提供了样板文件 cmake/example/CMakeUserPresets.SteamAPI.json,只需要少许修改即可使用:
- 将
cmake/example/CMakeUserPresets.SteamAPI.json文件复制到项目根目录 - 将文件重命名为
CMakeUserPresets.json - 修改
LUASTG_STEAM_API_APP_ID的值 - 执行命令
cmake --workflow --preset windows-amd64-my-steam-api-release执行 CMake 工作流
如果样板文件无法满足你的需求,可以自行修改。