- TypeInfo.h/cpp:TypeMeta(配置别名 + 内建基元解析),查询大小写不敏感; 提供 width/is_signed/is_float/tag/has_range/value_in_range - Codegen:layout_data 初值按 type_meta 的基元宽度/浮点写(删除手写宽度分支); const_id 的 tag 改查 type_meta - machine_test:+10 断言(BOOL 1B/range[0,1]/tag0、INT 2B 有符号、TIME 8B、大小写不敏感、未定义空) - 验收:line1 224 字节 hash 0xc3fe4ae74ad45900 不变、ctest 12/12
31 lines
1.0 KiB
CMake
31 lines
1.0 KiB
CMake
# CMake最低版本
|
||
cmake_minimum_required(VERSION 3.21)
|
||
|
||
# 工程名、版本号、工程描述
|
||
project(Compiler
|
||
VERSION 0.1
|
||
DESCRIPTION "ST / toml 编译器")
|
||
|
||
# 词法、语法、符号表、类型检查、codegen、链接都留在 compiler 一个库里
|
||
# 指令 opcode / 类型 / FB 布局来自 machine.toml(MachineConfig),不依赖 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
|
||
./src/TypeInfo.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)
|