added cmake as an optional build tool

This commit is contained in:
Aaro Koivukangas
2025-05-07 16:40:26 +03:00
parent 0615d9a03f
commit 33170f46c0
2 changed files with 38 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 4.0)
project(ttk91_compiler C CXX)
# https://cmake.org/cmake/help/latest/module/FindBISON.html
find_package(BISON)
bison_target(
ttk91_parser # name
src/parser.bison # input .bison file
src/parser.c # output .c
DEFINES_FILE include/token.h # output .h
OPTIONS -Wall -t # options
)
find_package(FLEX)
flex_target(
ttk91_scanner # name
scanner.flex # input
scanner.c # output
OPTIONS --warn
)
set(SOURCES
src/main.c
src/parser.c
src/scanner.c
src/program.c
src/expr.c
src/oper.c
src/ttk_register.c
src/label.c
src/value.c
src/comment.c
)
add_executable(ttk91_compiler ${SOURCES})
target_include_directories(ttk91_compiler PRIVATE include)