reflow-oven-control-sw/tprcc/CMakeLists.txt

46 lines
1.5 KiB
CMake
Raw Permalink Normal View History

2024-01-17 20:28:40 +01:00
cmake_minimum_required(VERSION 3.8)
project(tprcc LANGUAGES CXX)
set (CMAKE_CXX_STANDARD 17)
add_compile_options(-Wall -Wextra)
2024-01-17 20:28:40 +01:00
aux_source_directory("src" SRC_DIR)
aux_source_directory("src/tpr" SRC_TPR_DIR)
2024-01-17 20:28:40 +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}
${SRC_TPR_DIR}
2024-01-17 20:28:40 +01:00
${SRC_GENERATED}
)
2024-01-17 20:28:40 +01:00
add_custom_command(
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/parser/tpr.l
OUTPUT
${TPR_PARSER_DIR}/tpr-scanner.cpp
2024-01-17 20:28:40 +01:00
COMMAND
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
${TPR_PARSER_DIR}/tpr-parser.cpp
2024-01-17 20:28:40 +01:00
COMMAND
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})
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:
#target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")