Building an LLJIT-based calculator – JIT Compilation

Finally, to compile our JIT calculator source, we also need to create a CMakeLists.txt file with the build description, saved beside Calc.cpp and our other source files: cmake_minimum_required (VERSION 3.20.0)project (“jit”) find_package(LLVM REQUIRED CONFIG)list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR})include(DetermineGCCCompatible)include(ChooseMSVCCRT) add_definitions(${LLVM_DEFINITIONS})include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})llvm_map_components_to_libnames(llvm_libs Core OrcJITSupport native) if(LLVM_COMPILER_IS_GCC_COMPATIBLE)if(NOT LLVM_ENABLE_RTTI)set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -fno-rtti”)endif()if(NOT LLVM_ENABLE_EH)set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -fno-exceptions”)endif()endif() add_executable (calcCalc.cpp CodeGen.cpp Lexer.cpp Parser.cpp Sema.cpp)target_link_libraries(calc PRIVATE ${llvm_libs}) The preceding steps are …