Generate Bison output in CMake build tree

Again, moving away from in-tree builds
This commit is contained in:
ISSOtm
2026-04-10 22:56:59 +02:00
parent b430d5a8b8
commit 4577ff16bc
+12 -12
View File
@@ -27,13 +27,11 @@ if(BISON_VERSION VERSION_GREATER_EQUAL "3.7")
set(BISON_FLAGS "${BISON_FLAGS} -Wcounterexamples") set(BISON_FLAGS "${BISON_FLAGS} -Wcounterexamples")
endif() endif()
bison_target(ASM_PARSER "asm/parser.y" bison_target(asm_parser "asm/parser.y"
"${PROJECT_SOURCE_DIR}/src/asm/parser.cpp" "${CMAKE_CURRENT_BINARY_DIR}/asm/parser.cpp"
COMPILE_FLAGS "${BISON_FLAGS}" COMPILE_FLAGS "${BISON_FLAGS}")
DEFINES_FILE "${PROJECT_SOURCE_DIR}/src/asm/parser.hpp"
)
add_executable(rgbasm $<TARGET_OBJECTS:common> add_executable(rgbasm $<TARGET_OBJECTS:common>
"${BISON_ASM_PARSER_OUTPUT_SOURCE}" "${BISON_asm_parser_OUTPUT_SOURCE}"
"asm/actions.cpp" "asm/actions.cpp"
"asm/charmap.cpp" "asm/charmap.cpp"
"asm/fixpoint.cpp" "asm/fixpoint.cpp"
@@ -54,14 +52,14 @@ add_executable(rgbasm $<TARGET_OBJECTS:common>
"opmath.cpp" "opmath.cpp"
"verbosity.cpp" "verbosity.cpp"
) )
cmake_path(GET BISON_asm_parser_OUTPUT_HEADER PARENT_PATH parser_header_dir)
target_include_directories(rgbasm PRIVATE "${parser_header_dir}")
bison_target(LINKER_SCRIPT_PARSER "link/script.y" bison_target(linker_script_parser "link/script.y"
"${PROJECT_SOURCE_DIR}/src/link/script.cpp" "${CMAKE_CURRENT_BINARY_DIR}/link/script.cpp"
COMPILE_FLAGS "${BISON_FLAGS}" COMPILE_FLAGS "${BISON_FLAGS}")
DEFINES_FILE "${PROJECT_SOURCE_DIR}/src/link/script.hpp"
)
add_executable(rgblink $<TARGET_OBJECTS:common> add_executable(rgblink $<TARGET_OBJECTS:common>
"${BISON_LINKER_SCRIPT_PARSER_OUTPUT_SOURCE}" "${BISON_linker_script_parser_OUTPUT_SOURCE}"
"link/assign.cpp" "link/assign.cpp"
"link/fstack.cpp" "link/fstack.cpp"
"link/lexer.cpp" "link/lexer.cpp"
@@ -80,6 +78,8 @@ add_executable(rgblink $<TARGET_OBJECTS:common>
"opmath.cpp" "opmath.cpp"
"verbosity.cpp" "verbosity.cpp"
) )
cmake_path(GET BISON_linker_script_parser_OUTPUT_HEADER PARENT_PATH parser_header_dir)
target_include_directories(rgblink PRIVATE "${parser_header_dir}")
add_executable(rgbfix $<TARGET_OBJECTS:common> add_executable(rgbfix $<TARGET_OBJECTS:common>
"fix/fix.cpp" "fix/fix.cpp"