Files
fz-lang/CMakeLists.txt
samsonium a263b6206f wip: working on analyzer
- Feat: add assigns analysis
- Fix: change node check condition in binary math analysis
- Feat: add unary and binary conditions analysis
- Fix: add type passtrough in declaration analysis
- Feat: add unary math analysis
2026-10-27 12:21:49 +03:00

88 lines
2.4 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(fz-lang
LANGUAGES C)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_options(-Wall -Wextra -Werror=implicit-function-declaration)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-fsanitize=address,undefined -g)
add_link_options(-fsanitize=address,undefined)
endif()
include_directories(include)
# Compiler
add_executable(fzc
src/compiler/utils/fzl_const_pool.c
src/compiler/utils/fzl_symtable.c
src/compiler/utils/fzl_linked.c
src/compiler/utils/fzl_options.c
src/compiler/utils/fzl_ctable.c
src/compiler/checkers/fzl_loop_check.c
src/compiler/analyzer/utility.c
src/compiler/analyzer/context.c
src/compiler/analyzer/an_assign.c
src/compiler/analyzer/an_binmath.c
src/compiler/analyzer/an_block.c
src/compiler/analyzer/an_break.c
src/compiler/analyzer/an_call.c
src/compiler/analyzer/an_class.c
src/compiler/analyzer/an_common.c
src/compiler/analyzer/an_condition.c
src/compiler/analyzer/an_conditional.c
src/compiler/analyzer/an_construct.c
src/compiler/analyzer/an_declaration.c
src/compiler/analyzer/an_field.c
src/compiler/analyzer/an_function.c
src/compiler/analyzer/an_identifier.c
src/compiler/analyzer/an_loop.c
src/compiler/analyzer/an_return.c
src/compiler/analyzer/an_unarycond.c
src/compiler/analyzer/an_unarymath.c
src/compiler/fzl_analyzer.c
src/compiler/fzl_debug.c
src/compiler/fzl_parser.c
src/compiler/fzl_reader.c
src/compiler/fzl_token.c
src/compiler/fzl_walker.c
src/compiler/fzl_writer.c
src/compiler/main.c)
# Virtual machine
add_executable(fz
src/vm/fzl_vm.c
src/vm/fzl_vm_env.c
src/vm/fzl_vm_debug.c
src/vm/main.c)
#
# ========== Tests ==========
#
enable_testing()
file(GLOB TEST_PROGS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "tests/programs/*.fzs")
foreach (TEST_FILE IN LISTS TEST_PROGS)
get_filename_component(TEST_NAME "${TEST_FILE}" NAME_WE)
add_test(
NAME "progs_compile_${TEST_NAME}"
COMMAND fzc -o "${CMAKE_CURRENT_BINARY_DIR}/p_${TEST_NAME}.fzb" "${CMAKE_CURRENT_SOURCE_DIR}/${TEST_FILE}"
)
add_test(
NAME "progs_runtime_${TEST_NAME}"
COMMAND fz "${CMAKE_CURRENT_BINARY_DIR}/p_${TEST_NAME}.fzb"
)
if (TEST_NAME MATCHES "neg_")
set_tests_properties("progs_compile_${TEST_NAME}" PROPERTIES WILL_FAIL TRUE)
set_tests_properties("progs_runtime_${TEST_NAME}" PROPERTIES WILL_FAIL TRUE)
endif()
if (TEST_NAME MATCHES "negr_")
set_tests_properties("progs_runtime_${TEST_NAME}" PROPERTIES WILL_FAIL TRUE)
endif()
endforeach()