diff options
author | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2018-05-10 14:06:35 (GMT) |
---|---|---|
committer | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2018-05-10 14:06:35 (GMT) |
commit | 88e0c3e748783b040bebdc014ca717e6b5ec2df6 (patch) | |
tree | f3a703083fc869a879a8449e7a1ccdb74ce0dfe4 /src | |
parent | 1e64801bddccd15ab5d4c6b0f91f9e42a6914542 (diff) | |
parent | dcc66a4f157ace0858b788228550f3e104df3242 (diff) | |
download | hdf5-88e0c3e748783b040bebdc014ca717e6b5ec2df6.zip hdf5-88e0c3e748783b040bebdc014ca717e6b5ec2df6.tar.gz hdf5-88e0c3e748783b040bebdc014ca717e6b5ec2df6.tar.bz2 |
Merge branch 'develop' into hdf5_1_10.sync
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 123 | ||||
-rw-r--r-- | src/H5detect.c | 40 |
2 files changed, 78 insertions, 85 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 435fe9a..9ff70f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,11 +2,6 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_SRC C) #----------------------------------------------------------------------------- -# Apply Definitions to compiler in this directory and below -#----------------------------------------------------------------------------- -add_definitions (${HDF_EXTRA_C_FLAGS}) - -#----------------------------------------------------------------------------- # List Source Files #----------------------------------------------------------------------------- set (H5_SOURCES @@ -858,14 +853,13 @@ endif () # 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 () +target_include_directories(H5detect PRIVATE "${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) +TARGET_C_PROPERTIES (H5detect STATIC) +target_link_libraries (H5detect + PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}> $<$<PLATFORM_ID:Windows>:ws2_32.lib> + INTERFACE $<$<PLATFORM_ID:Emscripten>:"-O0"> +) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c @@ -875,14 +869,13 @@ add_custom_command ( ) 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 () +target_include_directories(H5make_libsettings PRIVATE "${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>") +target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) +TARGET_C_PROPERTIES (H5make_libsettings STATIC) +target_link_libraries (H5make_libsettings + PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}> $<$<PLATFORM_ID:Windows>:ws2_32.lib> + INTERFACE $<$<PLATFORM_ID:Emscripten>:"-O0"> +) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c @@ -892,34 +885,38 @@ add_custom_command ( WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) +## 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) + #----------------------------------------------------------------------------- # 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} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) -if (NOT WIN32) - target_link_libraries (${HDF5_LIB_TARGET} PUBLIC ${CMAKE_DL_LIBS}) -endif () +target_include_directories(${HDF5_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" +) +target_compile_definitions(${HDF5_LIB_TARGET} + PUBLIC + ${HDF_EXTRA_C_FLAGS} + ${HDF_EXTRA_FLAGS} + $<IF:$<CONFIG:Debug>,DEBUG,NDEBUG> + PRIVATE + $<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API> # Enable tracing of the API + $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> +) +TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) +target_link_libraries (${HDF5_LIB_TARGET} + PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}> + PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}> +) set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) 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> -) +set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) -## 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;H5CX_DEBUG;H5B2_DEBUG;H5AC_DEBUG" - ) -endif () set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) @@ -940,34 +937,30 @@ if (BUILD_SHARED_LIBS) ) 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} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) - if (NOT WIN32) - target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC ${CMAKE_DL_LIBS}) - endif () + target_include_directories(${HDF5_LIBSH_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" + ) + target_compile_definitions(${HDF5_LIBSH_TARGET} + PUBLIC + "H5_BUILT_AS_DYNAMIC_LIB" + ${HDF_EXTRA_C_FLAGS} + ${HDF_EXTRA_FLAGS} + $<IF:$<CONFIG:Debug>,DEBUG,NDEBUG> + PRIVATE + $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:H5_HAVE_THREADSAFE> + $<$<BOOL:${HDF5_ENABLE_TRACE}>:H5_DEBUG_API> # Enable tracing of the API + $<$<BOOL:${HDF5_ENABLE_DEBUG_APIS}>:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> + ) + TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) + target_link_libraries (${HDF5_LIBSH_TARGET} + PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}> + PUBLIC $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}> $<$<BOOL:${HDF5_ENABLE_THREADSAFE}>:Threads::Threads> + ) 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 "LIB") - set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES - FOLDER libraries - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 - ) - if (HDF5_ENABLE_THREADSAFE) - set_property (TARGET ${HDF5_LIBSH_TARGET} - APPEND PROPERTY COMPILE_DEFINITIONS - "H5_HAVE_THREADSAFE" - ) - target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC Threads::Threads) - endif () + set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES FOLDER libraries) - if (HDF5_ENABLE_DEBUG_APIS) - set_property (TARGET ${HDF5_LIBSH_TARGET} - APPEND PROPERTY COMPILE_DEFINITIONS - "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG" - ) - endif () set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET}) endif () diff --git a/src/H5detect.c b/src/H5detect.c index ff163cf..1c5554e 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -1360,8 +1360,8 @@ bit.\n"; * *------------------------------------------------------------------------- */ -static void -detect_C89_integers(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C89_integers(void) { DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; @@ -1388,8 +1388,8 @@ detect_C89_integers(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C89_floats(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C89_floats(void) { DETECT_F(float, FLOAT, d_g[nd_g]); nd_g++; DETECT_F(double, DOUBLE, d_g[nd_g]); nd_g++; @@ -1410,8 +1410,8 @@ detect_C89_floats(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_integers8(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_integers8(void) { #if H5_SIZEOF_INT8_T>0 #if H5_SIZEOF_INT8_T==1 @@ -1472,8 +1472,8 @@ detect_C99_integers8(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_integers16(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_integers16(void) { #if H5_SIZEOF_INT16_T>0 DETECT_I(int16_t, INT16, d_g[nd_g]); nd_g++; @@ -1510,8 +1510,8 @@ detect_C99_integers16(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_integers32(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_integers32(void) { #if H5_SIZEOF_INT32_T>0 DETECT_I(int32_t, INT32, d_g[nd_g]); nd_g++; @@ -1548,8 +1548,8 @@ detect_C99_integers32(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_integers64(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_integers64(void) { #if H5_SIZEOF_INT64_T>0 DETECT_I(int64_t, INT64, d_g[nd_g]); nd_g++; @@ -1599,8 +1599,8 @@ detect_C99_integers64(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_integers(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_integers(void) { /* break it down to more subroutines so that each module subroutine */ /* is smaller and takes less time to compile with optimization on. */ @@ -1625,8 +1625,8 @@ detect_C99_integers(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_floats(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_floats(void) { #if H5_SIZEOF_DOUBLE == H5_SIZEOF_LONG_DOUBLE /* @@ -1656,8 +1656,8 @@ detect_C99_floats(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_alignments(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_alignments(void) { /* Detect structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */ DETECT_M(void *, POINTER, m_g[na_g]); na_g++; @@ -1744,8 +1744,8 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) * *------------------------------------------------------------------------- */ -int -main(void) HDF_NO_UBSAN +int HDF_NO_UBSAN +main(void) { #if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) |