[brlcad-commits] SF.net SVN: brlcad:[51496] brlcad/trunk/src/other/step
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <sta...@us...> - 2012-07-13 14:27:30
|
Revision: 51496 http://brlcad.svn.sourceforge.net/brlcad/?rev=51496&view=rev Author: starseeker Date: 2012-07-13 14:27:23 +0000 (Fri, 13 Jul 2012) Log Message: ----------- Get a proper AUTO/ON/OFF toplevel configuration variable in place to control the use of perplex/re2c/lemon in SCL. Modified Paths: -------------- brlcad/trunk/src/other/step/CMakeLists.txt brlcad/trunk/src/other/step/src/express/CMakeLists.txt Modified: brlcad/trunk/src/other/step/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/step/CMakeLists.txt 2012-07-13 09:13:37 UTC (rev 51495) +++ brlcad/trunk/src/other/step/CMakeLists.txt 2012-07-13 14:27:23 UTC (rev 51496) @@ -222,11 +222,57 @@ file(READ ${SCL_SOURCE_DIR}/include/scl_cf_cmake.h.in CONFIG_H_FILE_CONTENTS) CONFIG_H_APPEND(SCL "${CONFIG_H_FILE_CONTENTS}") -find_package(LEMON) -if(NOT COMMAND LEMON_TARGET) - include(${SCL_CMAKE_DIR}/LEMON_Util.cmake) -endif(NOT COMMAND LEMON_TARGET) +# The Express parser uses the tools Perplex, RE2C and Lemon to generate code +# from higher level inputs. Depending on available tools and options, the +# SCL build can either re-generate code as part of the build, or use cached +# files that are ready for compilation. +# +# SCL_GENERATE_LEXER_PARSER is the "high level" control a user sets to determine +# how the SCL build will interact (or not) with these tools. AUTO (the +# default) means it will search for the necessary tools, and use them only if +# everything is found. If not, it will fall back to the cached versions. If +# this option is set to ON and the necessary tools are not found, the +# configure step will fail. If it is set to OFF, SCL will not even try to use +# the generators and will instead use the cached sources. +if(NOT SCL_GENERATE_LEXER_PARSER) + set(SCL_GENERATE_LEXER_PARSER "AUTO" CACHE STRING "Use Perplex, RE2C and Lemon to generate C source code.") +else(NOT SCL_GENERATE_LEXER_PARSER) + string(TOUPPER "${SCL_GENERATE_LEXER_PARSER}" SCL_GENERATE_LEXER_PARSER) +endif(NOT SCL_GENERATE_LEXER_PARSER) +set_property(CACHE SCL_GENERATE_LEXER_PARSER PROPERTY STRINGS AUTO ON OFF) +if (NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "AUTO" AND NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "ON" AND NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "OFF") + message(WARNING "Unknown value ${SCL_GENERATE_LEXER_PARSER} supplied for BRLCAD_WORD_SIZE - defaulting to AUTO") + message(WARNING "Valid options are AUTO, ON and OFF") + set(SCL_GENERATE_LEXER_PARSER "AUTO" CACHE STRING "Use Perplex, RE2C and Lemon to generate C source code.") +endif (NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "AUTO" AND NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "ON" AND NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "OFF") +# If the generators have not been turned off, we need to check for them +if(NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "OFF") + find_package(LEMON) + find_package(RE2C) + find_package(PERPLEX) + if(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE) + if(NOT COMMAND LEMON_TARGET) + include(${SCL_CMAKE_DIR}/LEMON_Util.cmake) + endif(NOT COMMAND LEMON_TARGET) + if(NOT COMMAND RE2C_TARGET) + include(${SCL_CMAKE_DIR}/RE2C_Util.cmake) + endif(NOT COMMAND RE2C_TARGET) + if(NOT COMMAND PERPLEX_TARGET) + include(${SCL_CMAKE_DIR}/PERPLEX_Util.cmake) + endif(NOT COMMAND PERPLEX_TARGET) + set(SCL_GENERATE_LP_SOURCES 1) + else(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE) + if("${SCL_GENERATE_LEXER_PARSER}" STREQUAL "ON") + message(FATAL_ERROR "\nSCL_GENERATE_LEXER_PARSER set to ON, but one or more components of the Perplex/RE2C/Lemon toolchain were not found.\n") + else("${SCL_GENERATE_LEXER_PARSER}" STREQUAL "ON") + set(SCL_GENERATE_LP_SOURCES 0) + endif("${SCL_GENERATE_LEXER_PARSER}" STREQUAL "ON") + endif(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE) +else(NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "OFF") + set(SCL_GENERATE_LP_SOURCES 0) +endif(NOT "${SCL_GENERATE_LEXER_PARSER}" STREQUAL "OFF") + INCLUDE(CheckLibraryExists) INCLUDE(CheckIncludeFile) INCLUDE(CheckFunctionExists) Modified: brlcad/trunk/src/other/step/src/express/CMakeLists.txt =================================================================== --- brlcad/trunk/src/other/step/src/express/CMakeLists.txt 2012-07-13 09:13:37 UTC (rev 51495) +++ brlcad/trunk/src/other/step/src/express/CMakeLists.txt 2012-07-13 14:27:23 UTC (rev 51496) @@ -4,13 +4,7 @@ ${SCL_SOURCE_DIR}/src/base ) -find_package(LEMON) -find_package(PERPLEX) -find_package(RE2C) -if(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND RE2C_EXECUTABLE) - include(${SCL_SOURCE_DIR}/cmake/LEMON_Util.cmake) - include(${SCL_SOURCE_DIR}/cmake/RE2C_Util.cmake) - include(${SCL_SOURCE_DIR}/cmake/PERPLEX_Util.cmake) +if(SCL_GENERATE_LP_SOURCES) LEMON_TARGET(ExpParser expparse.y expparse.c expparse.h) PERPLEX_TARGET(ExpScanner expscan.l ${CMAKE_CURRENT_BINARY_DIR}/expscan.c ${CMAKE_CURRENT_BINARY_DIR}/expscan.h) ADD_PERPLEX_LEMON_DEPENDENCY(ExpScanner ExpParser) @@ -18,13 +12,13 @@ ${LEMON_ExpParser_OUTPUT_SOURCE} ${PERPLEX_ExpScanner_OUTPUTS} ) -else(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND RE2C_EXECUTABLE) +else(SCL_GENERATE_LP_SOURCES) set(EXPRESS_GENERATED_SRCS generated/expparse.c generated/expscan.c ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/generated) -endif(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND RE2C_EXECUTABLE) +endif(SCL_GENERATE_LP_SOURCES) set(EXPRESS_SOURCES ${EXPRESS_GENERATED_SRCS} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |