2024-01-17 20:28:40 +01:00
|
|
|
cmake_minimum_required(VERSION 3.8)
|
|
|
|
project(tprcc LANGUAGES CXX)
|
|
|
|
|
|
|
|
set (CMAKE_CXX_STANDARD 17)
|
2024-01-18 23:27:06 +01:00
|
|
|
add_compile_options(-Wall -Wextra)
|
2024-01-17 20:28:40 +01:00
|
|
|
|
|
|
|
aux_source_directory("src" SRC_DIR)
|
2024-01-18 23:27:06 +01:00
|
|
|
aux_source_directory("src/tpr" SRC_TPR_DIR)
|
2024-01-17 20:28:40 +01:00
|
|
|
|
|
|
|
set (SRC_GENERATED "${CMAKE_CURRENT_BINARY_DIR}/tpr-parser.cpp" "${CMAKE_CURRENT_BINARY_DIR}/tpr-scanner.cpp")
|
|
|
|
|
|
|
|
set (SOURCES
|
|
|
|
${SRC_DIR}
|
2024-01-18 23:27:06 +01:00
|
|
|
${SRC_TPR_DIR}
|
2024-01-17 20:28:40 +01:00
|
|
|
${SRC_GENERATED}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
DEPENDS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.l
|
|
|
|
OUTPUT
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/tpr-scanner.cpp
|
|
|
|
COMMAND
|
|
|
|
flex -+ -o "${CMAKE_CURRENT_BINARY_DIR}/tpr-scanner.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.l"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
DEPENDS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.ypp
|
|
|
|
OUTPUT
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/tpr-parser.cpp
|
|
|
|
COMMAND
|
|
|
|
mkdir -p "${CMAKE_CURRENT_BINARY_DIR}/generated" && bison -o"${CMAKE_CURRENT_BINARY_DIR}/tpr-parser.cpp" --header="${CMAKE_CURRENT_BINARY_DIR}/generated/tpr-parser.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.ypp"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SET_SOURCE_FILES_PROPERTIES(${SRC_GENERATED} PROPERTIES GENERATED 1)
|
|
|
|
add_executable(${PROJECT_NAME} ${SOURCES})
|
|
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/generated")
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
|
|
|
# TEMPORARY FIx:
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|