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
|
|
|
|
2024-01-22 21:20:10 +01:00
|
|
|
set(TPR_PARSER_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated-tpr")
|
|
|
|
|
|
|
|
set (SRC_GENERATED "${TPR_PARSER_DIR}/tpr-parser.cpp" "${TPR_PARSER_DIR}/tpr-scanner.cpp")
|
2024-01-17 20:28:40 +01:00
|
|
|
|
|
|
|
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}
|
|
|
|
)
|
|
|
|
|
2024-01-22 21:20:10 +01:00
|
|
|
|
2024-01-17 20:28:40 +01:00
|
|
|
add_custom_command(
|
|
|
|
DEPENDS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.l
|
|
|
|
OUTPUT
|
2024-01-22 21:20:10 +01:00
|
|
|
${TPR_PARSER_DIR}/tpr-scanner.cpp
|
2024-01-17 20:28:40 +01:00
|
|
|
COMMAND
|
2024-01-22 21:20:10 +01:00
|
|
|
mkdir -p "${TPR_PARSER_DIR}" && flex -+ -o "${TPR_PARSER_DIR}/tpr-scanner.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.l"
|
2024-01-17 20:28:40 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
DEPENDS
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.ypp
|
|
|
|
OUTPUT
|
2024-01-22 21:20:10 +01:00
|
|
|
${TPR_PARSER_DIR}/tpr-parser.cpp
|
2024-01-17 20:28:40 +01:00
|
|
|
COMMAND
|
2024-01-22 21:20:10 +01:00
|
|
|
mkdir -p "${TPR_PARSER_DIR}/include/tpr-parser" && ${CMAKE_CURRENT_SOURCE_DIR}/bison-wrapper.sh "${TPR_PARSER_DIR}/tpr-parser.cpp" "${TPR_PARSER_DIR}/include/tpr-parser/tpr-parser.hpp" "${TPR_PARSER_DIR}/include/tpr-parser/location.hh" --header=tpr-parser.hpp ${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.ypp
|
2024-01-17 20:28:40 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
SET_SOURCE_FILES_PROPERTIES(${SRC_GENERATED} PROPERTIES GENERATED 1)
|
|
|
|
add_executable(${PROJECT_NAME} ${SOURCES})
|
|
|
|
|
2024-01-22 21:20:10 +01:00
|
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE "${TPR_PARSER_DIR}/include" "${TPR_PARSER_DIR}/include/tpr-parser")
|
2024-01-17 20:28:40 +01:00
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
|
|
|
# TEMPORARY FIx:
|
2024-01-22 21:20:10 +01:00
|
|
|
#target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
|