Files
Interpreter/compiler/CMakeLists.txt
T
Admin 447a8d0119 阶段 B 步骤 4:compiler 配置驱动化,去除 isa 依赖。
- Project.h 自带 IoBinding;Stb.h/cpp:compiler 侧 .stb 规范(常量/ConstEntry/FNV/StbView/读写/sidecar)
- Codec.h/cpp:指令字 pack/字段/配置驱动 disasm(format 表驱动)
- Codegen:opcode 全查 MachineConfig(E_* 发射器)、常量 tag 查配置类型、初值按基元宽度写、
  映像拼装用 Stb 常量;codegen_project 增加 cfg 参数
- main.cpp:--machine <path>(编译/反汇编必填),--disasm 用 StbView+Codec
- CMake:compiler 不再链接 isa(仅 toml++ 私有);测试补链 isa(自身断言用)
- 验证:20 用例字节不变(hash 0xc3fe4ae74ad45900 相同)、ctest 12/12、缺 --machine 报错退出
2026-08-21 22:14:29 +08:00

30 lines
1010 B
CMake
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CMake最低版本
cmake_minimum_required(VERSION 3.21)
# 工程名、版本号、工程描述
project(Compiler
VERSION 0.1
DESCRIPTION "ST / toml 编译器")
# 词法、语法、符号表、类型检查、codegen、链接都留在 compiler 一个库里
# 指令 opcode / 类型 / FB 布局来自 machine.tomlMachineConfig),不依赖 isa
add_library(compiler STATIC
./src/Lexer.cpp
./src/Project.cpp
./src/Parser.cpp
./src/Linker.cpp
./src/Typecheck.cpp
./src/Codegen.cpp
./src/MachineConfig.cpp
./src/Stb.cpp
./src/Codec.cpp)
target_include_directories(compiler PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(compiler PRIVATE ${CMAKE_SOURCE_DIR}/third_party/tomlplusplus/include)
# 可执行入口:STCompiler <project.toml> -o <name>.stb
add_executable(STCompiler
./src/main.cpp)
target_link_libraries(STCompiler PRIVATE compiler)