diff options
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r-- | src/CMakeLists.txt | 122 |
1 files changed, 94 insertions, 28 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e2acd30..435fe9a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required (VERSION 3.2.2) -PROJECT (HDF5_SRC C CXX) +cmake_minimum_required (VERSION 3.10) +project (HDF5_SRC C) #----------------------------------------------------------------------------- # Apply Definitions to compiler in this directory and below @@ -113,6 +113,14 @@ set (H5CS_HDRS IDE_GENERATED_PROPERTIES ("H5CS" "${H5CS_HDRS}" "${H5CS_SOURCES}" ) +set (H5CX_SOURCES + ${HDF5_SRC_DIR}/H5CX.c +) +set (H5CX_HDRS +) +IDE_GENERATED_PROPERTIES ("H5CX" "${H5CX_HDRS}" "${H5CX_SOURCES}" ) + + set (H5D_SOURCES ${HDF5_SRC_DIR}/H5D.c ${HDF5_SRC_DIR}/H5Dbtree.c @@ -454,6 +462,7 @@ set (H5O_SOURCES ${HDF5_SRC_DIR}/H5Oflush.c ${HDF5_SRC_DIR}/H5Ofsinfo.c ${HDF5_SRC_DIR}/H5Oginfo.c + ${HDF5_SRC_DIR}/H5Oint.c ${HDF5_SRC_DIR}/H5Olayout.c ${HDF5_SRC_DIR}/H5Olinfo.c ${HDF5_SRC_DIR}/H5Olink.c @@ -516,6 +525,9 @@ IDE_GENERATED_PROPERTIES ("H5PB" "${H5PB_HDRS}" "${H5PB_SOURCES}" ) set (H5PL_SOURCES ${HDF5_SRC_DIR}/H5PL.c + ${HDF5_SRC_DIR}/H5PLint.c + ${HDF5_SRC_DIR}/H5PLpath.c + ${HDF5_SRC_DIR}/H5PLplugin_cache.c ) set (H5PL_HDRS @@ -529,6 +541,7 @@ IDE_GENERATED_PROPERTIES ("H5PL" "${H5PL_HDRS}" "${H5PL_SOURCES}" ) set (H5R_SOURCES ${HDF5_SRC_DIR}/H5R.c ${HDF5_SRC_DIR}/H5Rdeprec.c + ${HDF5_SRC_DIR}/H5Rint.c ) set (H5R_HDRS ${HDF5_SRC_DIR}/H5Rpkg.h @@ -689,6 +702,7 @@ set (common_SRCS ${H5B2_SOURCES} ${H5C_SOURCES} ${H5CS_SOURCES} + ${H5CX_SOURCES} ${H5D_SOURCES} ${H5E_SOURCES} ${H5EA_SOURCES} @@ -768,6 +782,7 @@ set (H5_PRIVATE_HEADERS ${HDF5_SRC_DIR}/H5Bprivate.h ${HDF5_SRC_DIR}/H5Cprivate.h ${HDF5_SRC_DIR}/H5CSprivate.h + ${HDF5_SRC_DIR}/H5CXprivate.h ${HDF5_SRC_DIR}/H5Dprivate.h ${HDF5_SRC_DIR}/H5Eprivate.h ${HDF5_SRC_DIR}/H5EAprivate.h @@ -816,7 +831,7 @@ set (H5_GENERATED_HEADERS ${HDF5_SRC_DIR}/H5overflow.h ) -option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" OFF) +option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON) if (HDF5_GENERATE_HEADERS) set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE) find_package (Perl) @@ -839,98 +854,100 @@ if (HDF5_GENERATE_HEADERS) endif () #----------------------------------------------------------------------------- -# Setup the H5Detect utility which generates H5Tinit with platform +# Setup the H5detect utility which generates H5Tinit with platform # specific type checks inside #----------------------------------------------------------------------------- add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) +target_include_directories(H5detect PRIVATE ${HDF5_BINARY_DIR}) TARGET_C_PROPERTIES (H5detect STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5detect "ws2_32.lib") endif () +if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + set_property(TARGET H5detect PROPERTY LINK_FLAGS "-O0") +endif () -set (CMD $<TARGET_FILE:H5detect>) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5detect> ARGS > ${HDF5_BINARY_DIR}/H5Tinit.c DEPENDS H5detect ) add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) +target_include_directories(H5make_libsettings PRIVATE ${HDF5_BINARY_DIR}) TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") if (MSVC OR MINGW) target_link_libraries (H5make_libsettings "ws2_32.lib") endif () +if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + set_property(TARGET H5make_libsettings PROPERTY LINK_FLAGS "-O0") +endif () -set (CMD $<TARGET_FILE:H5make_libsettings>) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5make_libsettings> ARGS > ${HDF5_BINARY_DIR}/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) #----------------------------------------------------------------------------- -# Add H5Tinit source to build - generated by H5Detect/CMake at configure time +# Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- set (gen_SRCS ${HDF5_BINARY_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) +target_include_directories(${HDF5_LIB_TARGET} PUBLIC "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_LIB_TARGET} ${LINK_LIBS}) +target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) if (NOT WIN32) - target_link_libraries (${HDF5_LIB_TARGET} dl) -endif () -if (H5_HAVE_PARALLEL AND MPI_C_FOUND) - target_link_libraries (${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) + target_link_libraries (${HDF5_LIB_TARGET} PUBLIC ${CMAKE_DL_LIBS}) endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) -H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC) +H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries - INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" + INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include> ) +## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" +#all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) if (HDF5_ENABLE_DEBUG_APIS) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES COMPILE_DEFINITIONS - "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG" + "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5CX_DEBUG;H5B2_DEBUG;H5AC_DEBUG" ) endif () set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared") - set (CMD $<TARGET_FILE:H5detect>) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5Tinit.c - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5detect> ARGS > ${HDF5_BINARY_DIR}/shared/H5Tinit.c DEPENDS H5detect WORKING_DIRECTORY ${HDF5_BINARY_DIR}/shared ) - set (CMD $<TARGET_FILE:H5make_libsettings>) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c - COMMAND ${CMD} + COMMAND $<TARGET_FILE:H5make_libsettings> ARGS > ${HDF5_BINARY_DIR}/shared/H5lib_settings.c DEPENDS H5make_libsettings WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) set (shared_gen_SRCS ${HDF5_BINARY_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) + target_include_directories(${HDF5_LIBSH_TARGET} PUBLIC "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS}) + target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) if (NOT WIN32) - target_link_libraries (${HDF5_LIBSH_TARGET} dl) - endif () - if (H5_HAVE_PARALLEL AND MPI_C_FOUND) - target_link_libraries (${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) + target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC ${CMAKE_DL_LIBS}) endif () set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) + H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB") set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES FOLDER libraries COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" @@ -942,7 +959,7 @@ if (BUILD_SHARED_LIBS) APPEND PROPERTY COMPILE_DEFINITIONS "H5_HAVE_THREADSAFE" ) - target_link_libraries (${HDF5_LIBSH_TARGET} Threads::Threads) + target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC Threads::Threads) endif () if (HDF5_ENABLE_DEBUG_APIS) @@ -962,6 +979,7 @@ if (NOT HDF5_INSTALL_NO_DEVELOPMENT) FILES ${H5_PUBLIC_HEADERS} ${H5_GENERATED_HEADERS} + ${HDF5_BINARY_DIR}/H5pubconf.h DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT @@ -990,3 +1008,51 @@ if (HDF5_EXPORTED_TARGETS) INCLUDES DESTINATION include ) endif () + +#----------------------------------------------------------------------------- +# Create pkgconfig files +#----------------------------------------------------------------------------- +set (_PKG_CONFIG_PREFIX ${CMAKE_INSTALL_PREFIX}) +set (_PKG_CONFIG_EXEC_PREFIX \${prefix}) +set (_PKG_CONFIG_LIBDIR \${exec_prefix}/lib) +set (_PKG_CONFIG_INCLUDEDIR \${prefix}/include) +set (_PKG_CONFIG_LIBNAME "${HDF5_LIB_CORENAME}") +set (_PKG_CONFIG_VERSION "${HDF5_PACKAGE_VERSION}") + +foreach (libs ${LINK_LIBS} ${LINK_COMP_LIBS}) + set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}") +endforeach () + +set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${HDF5_LIB_CORENAME}") +if (BUILD_SHARED_LIBS) + set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${HDF5_LIB_CORENAME}") +endif () + +set (_PKG_CONFIG_REQUIRES) +set (_PKG_CONFIG_REQUIRES_PRIVATE) + +configure_file ( + ${HDF_RESOURCES_DIR}/libhdf5.pc.in + ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + @ONLY +) +install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/${HDF5_LIB_CORENAME}-${HDF5_PACKAGE_VERSION}.pc + DESTINATION ${HDF5_INSTALL_LIB_DIR}/pkgconfig + COMPONENT libraries +) + +if (NOT WIN32) + set (_PKG_CONFIG_COMPILER ${CMAKE_C_COMPILER}) + configure_file ( + ${HDF_RESOURCES_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5cc + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5cc + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT libraries + ) +endif () |