- Project.h/cpp:toml++ 解析 + 字段白名单(未知键带行号报错)、name/entry/cycle_limit/dt_ms/files.st 必填、io 条目完整性、entry 必须 program MAIN - compile_files:files.st ∪ gvl.file 去重;compute_project_hash:路径排序后 FNV-1a 64 增量,缺文件报 file missing - STCompiler <project.toml>:打印文件列表与哈希,失败退出码 1,--help - compiler 私有链接 toml++ v3.4.0;测试固化 compiler_toml(35 断言,line1 哈希冻结 0xc3fe4ae74ad45900)
23 lines
752 B
CMake
23 lines
752 B
CMake
# CMake最低版本
|
|
cmake_minimum_required(VERSION 3.21)
|
|
|
|
# 工程名、版本号、工程描述
|
|
project(Compiler
|
|
VERSION 0.1
|
|
DESCRIPTION "ST / toml 编译器")
|
|
|
|
# 词法、语法、符号表、类型检查、codegen、链接都留在 compiler 一个库里
|
|
add_library(compiler STATIC
|
|
./src/Lexer.cpp
|
|
./src/Project.cpp)
|
|
|
|
target_include_directories(compiler PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
|
target_include_directories(compiler PRIVATE ${CMAKE_SOURCE_DIR}/third_party/tomlplusplus/include)
|
|
target_link_libraries(compiler PUBLIC isa)
|
|
|
|
# 可执行入口:STCompiler <project.toml> -o <name>.stb
|
|
add_executable(STCompiler
|
|
./src/main.cpp)
|
|
|
|
target_link_libraries(STCompiler PRIVATE compiler)
|