A minimalistic programming language written in C89.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

53 linhas
1.5 KiB

6 meses atrás
6 meses atrás
6 meses atrás
  1. cmake_minimum_required(VERSION 3.0)
  2. project(ink C)
  3. include(CTest)
  4. set(CMAKE_C_STANDARD 90)
  5. add_library(ink lib.c include/ink.h)
  6. # Uncomment to disable the redundant arithmetic
  7. # add_definitions(-DNOEXTRAARITHMETIC)
  8. # Uncomment to disable array types
  9. # add_definitions(-DNOARRAYLIB)
  10. # Uncomment to disable string literal
  11. # add_definitions(-DNOSTRINGLITERALS)
  12. # Ensures the interpreter doesn't use the standard C library functions
  13. # add_definitions(-DNOSTDLIB)
  14. # Removes several checks to improve performance in cases where ink is used as a bytecode
  15. # add_definitions(-DNOEXTRACHECKS)
  16. add_definitions(-DINK_STEP_BATCH_COUNT=20)
  17. add_executable(ink_exe main.c)
  18. target_link_libraries(ink_exe PUBLIC ink)
  19. target_include_directories(ink PUBLIC include)
  20. # Functional tests
  21. function(add_success_compiled_test cfile success_regex)
  22. add_executable(${cfile} test/${cfile}.c)
  23. target_link_libraries(${cfile} PUBLIC ink)
  24. add_test(NAME ${cfile} COMMAND ${cfile})
  25. set_property (TEST ${cfile}
  26. PROPERTY PASS_REGULAR_EXPRESSION "${success_regex}")
  27. endfunction()
  28. add_success_compiled_test(sequence_of_20s "[20]+")
  29. add_success_compiled_test(macro_optimized "1000")
  30. add_success_compiled_test(array_shenanigans "Hello World\n\\[ 104 2 9 9 12 64 119 12 15 9 1 42 \\]\n")
  31. if(MSVC)
  32. target_compile_options(ink PRIVATE /W4 /WX)
  33. else()
  34. target_compile_options(ink PRIVATE -Wall -Wextra -Wpedantic -Werror)
  35. endif()
  36. # Benchmark is broken since the addition to coroutines
  37. # add_executable(ink_bench bench.c)
  38. # target_link_libraries(ink_bench PUBLIC ink)