mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00:49 +03:00
0031740: Configuration - recover support of Yacc and Lex generation
Scripts adm/cmake/bison.cmake and adm/cmake/flex.cmake are refactored to enable actual search for bison and flex. Apart of standard locations, also sub-folders of 3RDPARTY_DIR whose names contain "bison" and "flex", respectively, are added to search. Cache variables 3RDPARTY_BISON_EXECUTABLE and 3RDPARTY_FLEX_EXECUTABLE are removed to avoid confusion (they duplicated similar variables without "3RDPARTY_" prefix). Lex and Yacc files are corrected to match changes made manually in generated files during last years: - StepFile/step.yacc: correction missing from #22972 - StepFile/step.lex: corrected for compilation (broken by #31060) - MSVC-specific code is synchronized between StepFile/step.lex and ExprIntrp/ExprIntrp.lex - Old commented code and duplicate code blocks removed Commands for execution of Flex and Bison tools in CMake scripts are tweaked to avoid embedding line numbers (with local paths) in generated files. Scanners and parsers are regenerated from updated source files with modified options. Note that lex.ExprIntrp.c is regenerated with multiple differences because option -f (fast scanner) was used for generation of previous version (by WOK).
This commit is contained in:
@@ -2,19 +2,28 @@
|
||||
|
||||
# execute FindBISON script by "find_package (Bison)" is required to define BISON_TARGET macro
|
||||
|
||||
if (NOT DEFINED 3RDPARTY_BISON_EXECUTABLE)
|
||||
set (3RDPARTY_BISON_EXECUTABLE "" CACHE FILEPATH "The path to the bison command")
|
||||
# delete obsolete 3RDPARTY_BISON_EXECUTABLE cache variable (not used anymore)
|
||||
unset (3RDPARTY_BISON_EXECUTABLE CACHE)
|
||||
|
||||
# delete BISON_EXECUTABLE cache variable if it is empty, otherwise find_package will fail
|
||||
# without reasonable diagnostic
|
||||
if (NOT BISON_EXECUTABLE)
|
||||
unset (BISON_EXECUTABLE CACHE)
|
||||
endif()
|
||||
|
||||
# BISON_EXECUTABLE is required by BISON_TARGET macro and should be defined
|
||||
set (BISON_EXECUTABLE "${3RDPARTY_BISON_EXECUTABLE}" CACHE FILEPATH "path to the bison executable" FORCE)
|
||||
|
||||
find_package (BISON)
|
||||
|
||||
if (BISON_FOUND)
|
||||
set (3RDPARTY_BISON_EXECUTABLE "${BISON_EXECUTABLE}" CACHE FILEPATH "The Path to the bison command" FORCE)
|
||||
# Add paths to 3rdparty subfolders containing name "bison" to CMAKE_PROGRAM_PATH variable to make
|
||||
# these paths searhed by find_package
|
||||
if (3RDPARTY_DIR)
|
||||
file (GLOB BISON_PATHS LIST_DIRECTORIES true "${3RDPARTY_DIR}/*bison*/")
|
||||
foreach (candidate_path ${BISON_PATHS})
|
||||
if (IS_DIRECTORY ${candidate_path})
|
||||
list (APPEND CMAKE_PROGRAM_PATH ${candidate_path})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
find_package (BISON 2.7)
|
||||
|
||||
if (NOT 3RDPARTY_BISON_EXECUTABLE OR NOT EXISTS "${3RDPARTY_BISON_EXECUTABLE}")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_BISON_EXECUTABLE)
|
||||
if (NOT BISON_FOUND OR NOT BISON_EXECUTABLE OR NOT EXISTS "${BISON_EXECUTABLE}")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED BISON_EXECUTABLE)
|
||||
endif()
|
Reference in New Issue
Block a user