summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2015-09-29 17:23:55 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2015-09-29 17:23:55 (GMT)
commite8073c0d80189b1d1c8e5df94abe72b249f5aab8 (patch)
treea0ff3ef4cca04f9891553ce2700167f233317548
parentea70d11227bee77e9fc34f0435165365842bd138 (diff)
downloadhdf5-e8073c0d80189b1d1c8e5df94abe72b249f5aab8.zip
hdf5-e8073c0d80189b1d1c8e5df94abe72b249f5aab8.tar.gz
hdf5-e8073c0d80189b1d1c8e5df94abe72b249f5aab8.tar.bz2
[svn-r27910] Rework flex-bison generated files to eliminate dual depends when building both shared and static
-rw-r--r--config/cmake/HDF5_Process_Flex_Files.cmake28
-rw-r--r--hl/src/CMakeLists.txt48
2 files changed, 32 insertions, 44 deletions
diff --git a/config/cmake/HDF5_Process_Flex_Files.cmake b/config/cmake/HDF5_Process_Flex_Files.cmake
index 6ada04c..2306e93 100644
--- a/config/cmake/HDF5_Process_Flex_Files.cmake
+++ b/config/cmake/HDF5_Process_Flex_Files.cmake
@@ -1,6 +1,6 @@
# post process flex/bison files
-message (STATUS "File: ${FILE_PARSE} ${FILE_ANALYZE}")
+message (STATUS "File: ${GEN_DIR} ${FILE_PARSE} ${FILE_ANALYZE}")
if (FILE_PARSE)
# fix H5LTparse.c to declare H5LTyyparse return type as an hid_t
@@ -11,19 +11,19 @@ if (FILE_PARSE)
# I propose to not use flex to generate this function, but for now I am
# adding a perl command to find and replace this function declaration in
# H5LTparse.c.
- file (READ ${FILE_PARSE} TEST_STREAM)
+ file (READ ${GEN_DIR}/${FILE_PARSE}.c TEST_STREAM)
string (REGEX REPLACE "int yyparse" "hid_t yyparse" TEST_STREAM "${TEST_STREAM}")
string (REGEX REPLACE "int\nyyparse" "hid_t\nyyparse" TEST_STREAM "${TEST_STREAM}")
string (REGEX REPLACE "int H5LTyyparse" "hid_t H5LTyyparse" TEST_STREAM "${TEST_STREAM}")
- file (WRITE ${FILE_PARSE} "${TEST_STREAM}")
+ file (WRITE ${FILE_PARSE}.c "${TEST_STREAM}")
message (STATUS "replacing signature in H5LTparse.c")
# Add code that disables warnings in the flex/bison-generated code.
#
# Note that the GCC pragmas did not exist until gcc 4.2. Earlier versions
# will simply ignore them, but we want to avoid those warnings.
- file (READ ${FILE_PARSE} TEST_STREAM)
- file (WRITE ${FILE_PARSE} "
+ file (READ ${FILE_PARSE}.c TEST_STREAM)
+ file (WRITE ${FILE_PARSE}.c "
#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2\n
#pragma GCC diagnostic ignored \"-Wconversion\"\n
#pragma GCC diagnostic ignored \"-Wimplicit-function-declaration\"\n
@@ -45,12 +45,10 @@ if (FILE_PARSE)
#pragma warning(push, 1)\n
#endif\n
")
- file (APPEND ${FILE_PARSE} "${TEST_STREAM}")
- message (STATUS "processing pragma in ${FILE_PARSE}")
- execute_process (
- COMMAND ${CMAKE_COMMAND} -E touch ${FILE_PARSE}.timestamp
- DEPENDS "${FILE_PARSE}"
- )
+ file (APPEND ${FILE_PARSE}.c "${TEST_STREAM}")
+ message (STATUS "processed pragma in ${FILE_PARSE}")
+ file (READ ${GEN_DIR}/${FILE_PARSE}.h TEST_STREAM)
+ file (WRITE ${FILE_PARSE}.h "${TEST_STREAM}")
endif (FILE_PARSE)
if (FILE_ANALYZE)
@@ -58,7 +56,7 @@ if (FILE_ANALYZE)
#
# Note that the GCC pragmas did not exist until gcc 4.2. Earlier versions
# will simply ignore them, but we want to avoid those warnings.
- file (READ ${FILE_ANALYZE} TEST_STREAM)
+ file (READ ${GEN_DIR}/${FILE_ANALYZE} TEST_STREAM)
file (WRITE ${FILE_ANALYZE} "
#if __GNUC__ >= 4 && __GNUC_MINOR__ >=2\n
#pragma GCC diagnostic ignored \"-Wconversion\"\n
@@ -82,9 +80,5 @@ if (FILE_ANALYZE)
#endif\n
")
file (APPEND ${FILE_ANALYZE} "${TEST_STREAM}")
- message (STATUS "processing pragma in ${FILE_ANALYZE}")
- execute_process (
- COMMAND ${CMAKE_COMMAND} -E touch ${FILE_ANALYZE}.timestamp
- DEPENDS "${FILE_ANALYZE}"
- )
+ message (STATUS "processed pragma in ${FILE_ANALYZE}")
endif (FILE_ANALYZE)
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index fd99ce8..1821ec0 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -6,53 +6,47 @@ if (HDF5_GENERATE_HEADERS)
if (BISON_FOUND)
find_package (FLEX)
if (FLEX_FOUND)
- BISON_TARGET (H5LT_PARSER H5LTparse.y ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c COMPILE_FLAGS "-d -pH5LTyy")
+ BISON_TARGET (H5LT_PARSER H5LTparse.y ${CMAKE_CURRENT_BINARY_DIR}/genLT/H5LTparse.c COMPILE_FLAGS "-d -pH5LTyy")
if (WIN32)
- FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c COMPILE_FLAGS "--wincompat --nounistd -PH5LTyy")
+ FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/genLT/H5LTanalyze.c COMPILE_FLAGS "--wincompat --nounistd -PH5LTyy")
else (WIN32)
- FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c COMPILE_FLAGS "--nounistd -PH5LTyy")
+ FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/genLT/H5LTanalyze.c COMPILE_FLAGS "--nounistd -PH5LTyy")
endif (WIN32)
ADD_FLEX_BISON_DEPENDENCY(H5LT_SCANNER H5LT_PARSER)
if (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
- set (HL_SRCS
- ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c
- ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c
- )
- set (HL_HEADERS
- ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.h
- )
- set_source_files_properties (${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c GENERATED)
- set_source_files_properties (${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c GENERATED)
- set_source_files_properties (${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.h GENERATED)
add_custom_command (
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c.timestamp
+ OUTPUT H5LTparse.c H5LTparse.h
COMMAND "${CMAKE_COMMAND}"
- -D "FILE_PARSE=H5LTparse.c"
+ -D "GEN_DIR=genLT"
+ -D "FILE_PARSE=H5LTparse"
-P "${HDF_RESOURCES_DIR}/HDF5_Process_Flex_Files.cmake"
- DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c"
+ DEPENDS "genLT/H5LTparse.c"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_command (
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c.timestamp
+ OUTPUT H5LTanalyze.c
COMMAND "${CMAKE_COMMAND}"
+ -D "GEN_DIR=genLT"
-D "FILE_ANALYZE=H5LTanalyze.c"
-P "${HDF_RESOURCES_DIR}/HDF5_Process_Flex_Files.cmake"
- DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c"
+ DEPENDS "genLT/H5LTanalyze.c"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ add_custom_target (process_gen_H5LT
+ DEPENDS H5LTparse.c H5LTanalyze.c
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
- add_custom_target (process_gen_H5LT DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c.timestamp ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c.timestamp)
-# add_custom_target (process_gen_H5LT
-# COMMAND "${CMAKE_COMMAND}"
-# -D "FILE_PARSE=${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c"
-# -D "FILE_ANALYSE=${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c"
-# -P "${HDF5_RESOURCE_DIR}/HDF5_Process_Flex_Files.cmake"
-# DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c"
-# COMMENT "Prepending pragma statements"
-# )
+ set (HL_SRCS
+ ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c
+ ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c
+ )
+ set (HL_HEADERS
+ ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.h
+ )
else (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED)
message (STATUS "Error during generate of files")
endif (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED)