summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
Diffstat (limited to 'hl')
-rw-r--r--hl/src/CMakeLists.txt77
1 files changed, 77 insertions, 0 deletions
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index 23943f9..e10e1b0 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -1,6 +1,73 @@
cmake_minimum_required (VERSION 3.1.0)
PROJECT (HDF5_HL_SRC)
+if (HDF5_GENERATE_HEADERS)
+ file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/genLT")
+ find_package (BISON)
+ if (BISON_FOUND)
+ find_package (FLEX)
+ if (FLEX_FOUND)
+ 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}/genLT/H5LTanalyze.c COMPILE_FLAGS "--wincompat --nounistd -PH5LTyy")
+ else (WIN32)
+ 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})
+
+ add_custom_command (
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.h
+ PRE_BUILD
+ COMMAND "${CMAKE_COMMAND}"
+ -D "GEN_DIR=genLT"
+ -D "FILE_PARSE=H5LTparse"
+ -P "${HDF_RESOURCES_DIR}/HDF5_Process_Flex_Files.cmake"
+ DEPENDS "${BISON_H5LT_PARSER_OUTPUTS}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ add_custom_command (
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c
+ PRE_BUILD
+ COMMAND "${CMAKE_COMMAND}"
+ -D "GEN_DIR=genLT"
+ -D "FILE_ANALYZE=H5LTanalyze.c"
+ -P "${HDF_RESOURCES_DIR}/HDF5_Process_Flex_Files.cmake"
+ DEPENDS "${FLEX_H5LT_SCANNER_OUTPUTS}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ )
+ add_custom_target (process_gen_H5LT
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c
+ WORKING_DIRECTORY ${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
+ )
+ 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)
+ else (FLEX_FOUND)
+ message (STATUS "Cannot generate files - flex not found")
+ endif (FLEX_FOUND)
+ else (BISON_FOUND)
+ message (STATUS "Cannot generate files - bison not found")
+ endif (BISON_FOUND)
+else (HDF5_GENERATE_HEADERS)
+ set (HL_SRCS
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c
+ )
+ set (HL_HEADERS
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h
+ )
+endif (HDF5_GENERATE_HEADERS)
#-----------------------------------------------------------------------------
# List Source files
@@ -37,6 +104,11 @@ set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES
)
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}")
set (install_targets ${HDF5_HL_LIB_TARGET})
+if (HDF5_GENERATE_HEADERS)
+ add_dependencies(${HDF5_HL_LIB_TARGET} process_gen_H5LT)
+else (HDF5_GENERATE_HEADERS)
+ add_dependencies(${HDF5_HL_LIB_TARGET} "${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c;${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c")
+endif (HDF5_GENERATE_HEADERS)
if (BUILD_SHARED_LIBS)
add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SRCS} ${HL_HEADERS})
@@ -51,6 +123,11 @@ if (BUILD_SHARED_LIBS)
)
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIBSH_TARGET}")
set (install_targets ${install_targets} ${HDF5_HL_LIBSH_TARGET})
+ if (HDF5_GENERATE_HEADERS)
+ add_dependencies(${HDF5_HL_LIBSH_TARGET} process_gen_H5LT)
+ else (HDF5_GENERATE_HEADERS)
+ add_dependencies(${HDF5_HL_LIBSH_TARGET} "${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c;${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c")
+ endif (HDF5_GENERATE_HEADERS)
endif (BUILD_SHARED_LIBS)
#-----------------------------------------------------------------------------