|
@@ -13,23 +13,28 @@ set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-find_package(BISON 3.0.0 REQUIRED)
|
|
|
|
-find_package(FLEX 2.4.0 REQUIRED)
|
|
|
|
|
|
+find_package(BISON 3.0.0)
|
|
|
|
+find_package(FLEX 2.4.0)
|
|
find_package(LLVM REQUIRED CONFIG)
|
|
find_package(LLVM REQUIRED CONFIG)
|
|
|
|
|
|
if( NOT LLVM_FOUND )
|
|
if( NOT LLVM_FOUND )
|
|
message(FATAL_ERROR "LLVM package can't be found. Set CMAKE_PREFIX_PATH variable to LLVM's installation prefix.")
|
|
message(FATAL_ERROR "LLVM package can't be found. Set CMAKE_PREFIX_PATH variable to LLVM's installation prefix.")
|
|
endif()
|
|
endif()
|
|
|
|
|
|
-BISON_TARGET(QlowParser ast/syntax.y ${CMAKE_CURRENT_BINARY_DIR}/syntax.cpp)
|
|
|
|
-FLEX_TARGET(QlowLexer ast/lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
|
|
|
|
-ADD_FLEX_BISON_DEPENDENCY(QlowLexer QlowParser)
|
|
|
|
|
|
+if ( BISON_FOUND AND FLEX_FOUND )
|
|
|
|
+ BISON_TARGET(QlowParser ast/syntax.y ${CMAKE_CURRENT_BINARY_DIR}/syntax.cpp)
|
|
|
|
+ FLEX_TARGET(QlowLexer ast/lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
|
|
|
|
+ ADD_FLEX_BISON_DEPENDENCY(QlowLexer QlowParser)
|
|
|
|
+else()
|
|
|
|
+ FILE(GLOB AdditionalSources bison/*.cpp)
|
|
|
|
+ include_directories(bison/)
|
|
|
|
+endif()
|
|
|
|
|
|
FILE(GLOB CppSources *.cpp ast/*.cpp sem/*.cpp)
|
|
FILE(GLOB CppSources *.cpp ast/*.cpp sem/*.cpp)
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
include_directories(ast sem .)
|
|
include_directories(ast sem .)
|
|
|
|
|
|
-add_executable(${PROJECT_NAME} ${BISON_QlowParser_OUTPUTS} ${FLEX_QlowLexer_OUTPUTS} ${CppSources})
|
|
|
|
|
|
+add_executable(${PROJECT_NAME} ${BISON_QlowParser_OUTPUTS} ${FLEX_QlowLexer_OUTPUTS} ${CppSources} ${AdditionalSources})
|
|
|
|
|
|
|
|
|
|
include_directories( ${LLVM_INCLUDE_DIRS} )
|
|
include_directories( ${LLVM_INCLUDE_DIRS} )
|