From e040db8331952bc417b1aba78f1e6809028532f4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 9 Sep 2015 14:36:47 -0500 Subject: [svn-r27725] Add initial commands to properly build the generated files. Added HDF5_GENERATE_HEADERS ON to cacheinit.cmake file. Tested: local linux --- config/cmake/HDF5Macros.cmake | 70 +++++++++++++++++++++++++++++++++++++++++++ config/cmake/cacheinit.cmake | 2 ++ hl/src/CMakeLists.txt | 55 ++++++++++++++++++++++++++++++---- src/CMakeLists.txt | 55 ++++++++++++++++++++-------------- 4 files changed, 154 insertions(+), 28 deletions(-) diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index 976b910..aa834e6 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -41,3 +41,73 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype) endif (APPLE) endmacro (H5_SET_LIB_OPTIONS) + +macro (H5_GEN_PERL_FILES) + find_package (Perl) + if (PERL_FOUND) + add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/H5Edefin.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_err.pl ${HDF5_SOURCE_DIR}/src/H5err.txt + DEPENDS ${HDF5_SOURCE_DIR}/src/H5err.txt + COMMENT " Creating err header" + ) + + add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/H5version.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_vers.pl ${HDF5_SOURCE_DIR}/src/H5vers.txt + DEPENDS ${HDF5_SOURCE_DIR}/src/H5vers.txt + COMMENT " Creating API version macro" + ) + + add_custom_command ( + OUTPUT ${HDF5_BINARY_DIR}/H5overflow.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow.pl ${HDF5_SOURCE_DIR}/src/H5overflow.txt + DEPENDS ${HDF5_SOURCE_DIR}/src/H5overflow.txt + COMMENT " Creating Assignment overflow macro" + ) + + add_custom_target(run_perl_scripts ALL + DEPENDS ${HDF5_BINARY_DIR}/H5Edefin.h ${HDF5_BINARY_DIR}/H5version.h ${HDF5_BINARY_DIR}/H5overflow.h + ) + else (PERL_FOUND) + message (STATUS "Cannot generate headers - perl not found") + endif (PERL_FOUND) +endmacro (H5_GEN_PERL_FILES) + +macro (H5_GEN_FLEX_FILES) + find_package (BISON) + if (BISON_FOUND) + find_package (FLEX) + if (FLEX_FOUND) + BISON_TARGET (H5LT_PARSER H5LTparse.y ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c COMPILE_FLAGS -d) + if (WIN32) + FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c COMPILE_FLAGS --wincompat) + else (WIN32) + FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c) + endif (WIN32) + ADD_FLEX_BISON_DEPENDENCY(H5LT_SCANNER H5LT_PARSER) + + if (BISON_H5LT_PARSER_DEFINED AND FLEX_H5LT_SCANNER_DEFINED) + set_source_files_properties (${FLEX_H5LT_SCANNER_OUTPUTS} + PROPERTIES OBJECT_DEPENDS ${BISON_H5LT_PARSER_OUTPUTS}) + set (HL_SRCS + ${BISON_H5LT_PARSER_OUTPUTS} + ${FLEX_H5LT_SCANNER_OUTPUTS} + ) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) + 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) +endmacro (H5_GEN_FLEX_FILES) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 4bef99f..e4ba880 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -8,6 +8,8 @@ set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Framework set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) +set (HDF5_GENERATE_HEADERS ON CACHE BOOL "Rebuild Generated Files" FORCE) + set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) set (HDF5_BUILD_GENERATORS OFF CACHE BOOL "Build Test Generators" FORCE) diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 23943f9..9603e69 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -1,26 +1,71 @@ cmake_minimum_required (VERSION 3.1.0) PROJECT (HDF5_HL_SRC) +if (HDF5_GENERATE_HEADERS) + find_package (BISON) + if (BISON_FOUND) + find_package (FLEX) + if (FLEX_FOUND) + BISON_TARGET (H5LT_PARSER H5LTparse.y ${CMAKE_CURRENT_BINARY_DIR}/H5LTparse.c COMPILE_FLAGS -d) + if (WIN32) + FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c COMPILE_FLAGS --wincompat) + else (WIN32) + FLEX_TARGET (H5LT_SCANNER H5LTanalyze.l ${CMAKE_CURRENT_BINARY_DIR}/H5LTanalyze.c) + 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) + 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 #----------------------------------------------------------------------------- set (HL_SRCS + ${HL_SRCS} ${HDF5_HL_SRC_SOURCE_DIR}/H5DO.c ${HDF5_HL_SRC_SOURCE_DIR}/H5DS.c ${HDF5_HL_SRC_SOURCE_DIR}/H5IM.c ${HDF5_HL_SRC_SOURCE_DIR}/H5LT.c - ${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c - ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c + #${HDF5_HL_SRC_SOURCE_DIR}/H5LTanalyze.c + #${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.c ${HDF5_HL_SRC_SOURCE_DIR}/H5PT.c ${HDF5_HL_SRC_SOURCE_DIR}/H5TB.c ) set (HL_HEADERS + ${HL_HEADERS} ${HDF5_HL_SRC_SOURCE_DIR}/H5DOpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5DSpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5IMpublic.h - ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h + #${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h ${HDF5_HL_SRC_SOURCE_DIR}/H5LTpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5PTpublic.h ${HDF5_HL_SRC_SOURCE_DIR}/H5TBpublic.h @@ -54,7 +99,7 @@ if (BUILD_SHARED_LIBS) endif (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- -# Add file(s) to CMake Install +# Add file(s) to CMake Install #----------------------------------------------------------------------------- install ( FILES @@ -72,7 +117,7 @@ if (HDF5_EXPORTED_TARGETS) if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) endif (BUILD_SHARED_LIBS) - + install ( TARGETS ${install_targets} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dc6ba0a..d840c21 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,8 +22,8 @@ set (H5_HDRS ${HDF5_SRC_DIR}/hdf5.h ${HDF5_SRC_DIR}/H5api_adpt.h ${HDF5_SRC_DIR}/H5public.h - ${HDF5_SRC_DIR}/H5version.h - ${HDF5_SRC_DIR}/H5overflow.h + #${HDF5_SRC_DIR}/H5version.h + #${HDF5_SRC_DIR}/H5overflow.h ) IDE_GENERATED_PROPERTIES ("H5" "${H5_HDRS}" "${H5_SRCS}" ) @@ -133,12 +133,12 @@ set (H5E_SRCS ) set (H5E_HDRS - ${HDF5_SRC_DIR}/H5Edefin.h - ${HDF5_SRC_DIR}/H5Einit.h + #${HDF5_SRC_DIR}/H5Edefin.h + #${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epkg.h - ${HDF5_SRC_DIR}/H5Epubgen.h + #${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Epublic.h - ${HDF5_SRC_DIR}/H5Eterm.h + #${HDF5_SRC_DIR}/H5Eterm.h ) IDE_GENERATED_PROPERTIES ("H5E" "${H5E_HDRS}" "${H5E_SRCS}" ) @@ -801,57 +801,66 @@ add_custom_command ( WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) -if (GENERATE_ERROR_HEADERS) +if (HDF5_GENERATE_HEADERS) find_package (Perl) if (PERL_FOUND) add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5Edefin.h + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5Edefin.h ${CMAKE_CURRENT_BINARY_DIR}/H5Einit.h ${CMAKE_CURRENT_BINARY_DIR}/H5Epubgen.h ${CMAKE_CURRENT_BINARY_DIR}/H5Eterm.h PRE_BUILD COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SOURCE_DIR}/src/H5err.txt + ARGS ${HDF5_SOURCE_DIR}/bin/make_err.pl ${HDF5_SOURCE_DIR}/src/H5err.txt DEPENDS ${HDF5_SOURCE_DIR}/src/H5err.txt COMMENT " Creating err header" ) add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5version.h + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5version.h PRE_BUILD COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SOURCE_DIR}/src/H5vers.txt + ARGS ${HDF5_SOURCE_DIR}/bin/make_vers.pl ${HDF5_SOURCE_DIR}/src/H5vers.txt DEPENDS ${HDF5_SOURCE_DIR}/src/H5vers.txt COMMENT " Creating API version macro" ) add_custom_command ( - OUTPUT ${HDF5_BINARY_DIR}/H5overflow.h + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/H5overflow.h PRE_BUILD COMMAND ${PERL_EXECUTABLE} - ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SOURCE_DIR}/src/H5overflow.txt + ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow.pl ${HDF5_SOURCE_DIR}/src/H5overflow.txt DEPENDS ${HDF5_SOURCE_DIR}/src/H5overflow.txt COMMENT " Creating Assignment overflow macro" ) add_custom_target(run_perl_scripts ALL - DEPENDS ${HDF5_BINARY_DIR}/H5Edefin.h ${HDF5_BINARY_DIR}/H5version.h ${HDF5_BINARY_DIR}/H5overflow.h + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/H5Edefin.h ${CMAKE_CURRENT_BINARY_DIR}/H5version.h ${CMAKE_CURRENT_BINARY_DIR}/H5overflow.h ) else (PERL_FOUND) message (STATUS "Cannot generate headers - perl not found") endif (PERL_FOUND) -endif (GENERATE_ERROR_HEADERS) +endif (HDF5_GENERATE_HEADERS) #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5Detect/CMake at configure time #----------------------------------------------------------------------------- set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5Tinit.c) -set_source_files_properties (${HDF5_BINARY_DIR}/H5Tinit.c GENERATED) set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5lib_settings.c) -set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c GENERATED) -set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5Edefin.h) -set_source_files_properties (${HDF5_BINARY_DIR}/H5Edefin.h GENERATED) -set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5version.h) -set_source_files_properties (${HDF5_BINARY_DIR}/H5version.h GENERATED) -set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5overflow.h) -set_source_files_properties (${HDF5_BINARY_DIR}/H5overflow.h GENERATED) + +if (HDF5_GENERATE_HEADERS) + set (common_SRCS ${common_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/H5Edefin.h) + set (common_SRCS ${common_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/H5Einit.h) + set (common_SRCS ${common_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/H5Epubgen.h) + set (common_SRCS ${common_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/H5Eterm.h) + set (common_SRCS ${common_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/H5version.h) + set (common_SRCS ${common_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/H5overflow.h) + include_directories(${CMAKE_CURRENT_BINARY_DIR}) +else (HDF5_GENERATE_HEADERS) + set (common_SRCS ${common_SRCS} ${HDF5_SRC_DIR}/H5Edefin.h) + set (common_SRCS ${common_SRCS} ${HDF5_SRC_DIR}/H5Einit.h) + set (common_SRCS ${common_SRCS} ${HDF5_SRC_DIR}/H5Epubgen.h) + set (common_SRCS ${common_SRCS} ${HDF5_SRC_DIR}/H5Eterm.h) + set (common_SRCS ${common_SRCS} ${HDF5_SRC_DIR}/H5version.h) + set (common_SRCS ${common_SRCS} ${HDF5_SRC_DIR}/H5overflow.h) +endif (HDF5_GENERATE_HEADERS) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS}) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") -- cgit v0.12