diff options
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 115 |
1 files changed, 60 insertions, 55 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0e555c2..fce59c2 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}" ) @@ -134,12 +134,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}" ) @@ -722,7 +722,6 @@ set (H5_PUBLIC_HEADERS ${H5Z_HDRS} ) - set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5private.h ${HDF5_SRC_DIR}/H5Aprivate.h @@ -769,6 +768,56 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5win32defs.h ) +set (H5_GENERATED_HEADERS + ${HDF5_SRC_DIR}/H5Edefin.h + ${HDF5_SRC_DIR}/H5Einit.h + ${HDF5_SRC_DIR}/H5Epubgen.h + ${HDF5_SRC_DIR}/H5Eterm.h + ${HDF5_SRC_DIR}/H5version.h + ${HDF5_SRC_DIR}/H5overflow.h +) + +if (HDF5_GENERATE_HEADERS) + find_package (Perl) + if (PERL_FOUND) + add_custom_command ( + OUTPUT ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5Einit.h ${HDF5_SRC_DIR}/H5Epubgen.h ${HDF5_SRC_DIR}/H5Eterm.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_err ${HDF5_SRC_DIR}/H5err.txt + DEPENDS ${HDF5_SRC_DIR}/H5err.txt + COMMENT " Creating err header" + ) + + add_custom_command ( + OUTPUT ${HDF5_SRC_DIR}/H5version.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_vers ${HDF5_SRC_DIR}/H5vers.txt + DEPENDS ${HDF5_SRC_DIR}/H5vers.txt + COMMENT " Creating API version macro" + ) + + add_custom_command ( + OUTPUT ${HDF5_SRC_DIR}/H5overflow.h + PRE_BUILD + COMMAND ${PERL_EXECUTABLE} + ARGS ${HDF5_SOURCE_DIR}/bin/make_overflow ${HDF5_SRC_DIR}/H5overflow.txt + DEPENDS ${HDF5_SRC_DIR}/H5overflow.txt + COMMENT " Creating Assignment overflow macro" + ) + + add_custom_target(generate_precompiled DEPENDS + "${HDF5_SRC_DIR}/H5version.h;${HDF5_SRC_DIR}/H5overflow.h") + + add_custom_target(run_perl_scripts ALL + DEPENDS ${HDF5_SRC_DIR}/H5Edefin.h ${HDF5_SRC_DIR}/H5version.h ${HDF5_SRC_DIR}/H5overflow.h + ) + else (PERL_FOUND) + message (STATUS "Cannot generate headers - perl not found") + endif (PERL_FOUND) +endif (HDF5_GENERATE_HEADERS) + #----------------------------------------------------------------------------- # Setup the H5Detect utility which generates H5Tinit with platform # specific type checks inside @@ -778,6 +827,7 @@ TARGET_C_PROPERTIES (H5detect STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") endif (MSVC OR MINGW) +add_dependencies(H5detect generate_precompiled) set (CMD $<TARGET_FILE:H5detect>) add_custom_command ( @@ -792,6 +842,7 @@ TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5make_libsettings "ws2_32.lib") endif (MSVC OR MINGW) +add_dependencies(H5make_libsettings generate_precompiled) set (CMD $<TARGET_FILE:H5make_libsettings>) add_custom_command ( @@ -802,59 +853,13 @@ add_custom_command ( WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) -if (GENERATE_ERROR_HEADERS) - 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 ${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 ${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 ${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) -endif (GENERATE_ERROR_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) - -add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS}) + +add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS}) if (NOT WIN32) |