A Hugo incarnation of the blog.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

CMakeLists.txt 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. cmake_minimum_required(VERSION 3.1)
  2. project(compiler)
  3. # We want C++17 for std::optional
  4. set(CMAKE_CXX_STANDARD 17)
  5. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  6. # Find all the required packages
  7. find_package(BISON)
  8. find_package(FLEX)
  9. find_package(LLVM REQUIRED CONFIG)
  10. # Set up the flex and bison targets
  11. bison_target(parser
  12. ${CMAKE_CURRENT_SOURCE_DIR}/parser.y
  13. ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
  14. COMPILE_FLAGS "-d")
  15. flex_target(scanner
  16. ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l
  17. ${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp)
  18. add_flex_bison_dependency(scanner parser)
  19. # Find all the relevant LLVM components
  20. llvm_map_components_to_libnames(LLVM_LIBS core x86asmparser x86codegen)
  21. # Create compiler executable
  22. add_executable(compiler
  23. definition.cpp definition.hpp
  24. parsed_type.cpp parsed_type.hpp
  25. ast.cpp ast.hpp
  26. llvm_context.cpp llvm_context.hpp
  27. type_env.cpp type_env.hpp
  28. env.cpp env.hpp
  29. type.cpp type.hpp
  30. error.cpp error.hpp
  31. binop.cpp binop.hpp
  32. instruction.cpp instruction.hpp
  33. graph.cpp graph.hpp
  34. global_scope.cpp global_scope.hpp
  35. parse_driver.cpp parse_driver.hpp
  36. mangler.cpp mangler.hpp
  37. compiler.cpp compiler.hpp
  38. ${BISON_parser_OUTPUTS}
  39. ${FLEX_scanner_OUTPUTS}
  40. main.cpp
  41. )
  42. # Configure compiler executable
  43. target_include_directories(compiler PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
  44. target_include_directories(compiler PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
  45. target_include_directories(compiler PUBLIC ${LLVM_INCLUDE_DIRS})
  46. target_compile_definitions(compiler PUBLIC ${LLVM_DEFINITIONS})
  47. target_link_libraries(compiler ${LLVM_LIBS})