From f94d1fac4f7a4bc84f8f3e94818c3f2b556922ae Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Sun, 4 May 2025 10:39:59 -0500 Subject: [PATCH 1/2] build: fix i386 obsd-7.7 threads link error --- CMakeLists.txt | 68 ++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c83a28b0859..897e5386037 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,6 @@ cmake_minimum_required (VERSION 3.18) +# set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) +# set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) project (HDF5 C) if (POLICY CMP0074) @@ -564,14 +566,6 @@ endif () set (CMAKE_POSITION_INDEPENDENT_CODE ON) -#----------------------------------------------------------------------------- -# perl is used in some optional src and tests, check availability -find_package (Perl) -if (PERL_FOUND) - set (H5_PERL_FOUND YES) -endif () -#----------------------------------------------------------------------------- - #----------------------------------------------------------------------------- # Option to Build Static executables #----------------------------------------------------------------------------- @@ -799,35 +793,37 @@ endif () # Determine if a threading package is available on this system option (HDF5_ENABLE_THREADS "Enable thread support" ON) -set (THREADS_PREFER_PTHREAD_FLAG ON) -find_package (Threads) -if (Threads_FOUND) - set (H5_HAVE_THREADS 1) - set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) - - # Determine which threading package to use - # Comment out check for C11 threads for now, since it conflicts with the - # current --std=c99 compile flags at configuration time. When we switch to - # --std=c11, this can be uncommented. - #CHECK_INCLUDE_FILE("threads.h" HAVE_THREADS_H) - if (WIN32) - # When Win32 is available, we use those threads - set (H5_HAVE_WIN_THREADS 1) - elseif (HAVE_THREADS_H) - # When C11 threads are available, those are the top choice - set (H5_HAVE_C11_THREADS 1) - elseif (CMAKE_USE_PTHREADS_INIT) - set (H5_HAVE_PTHREAD_H 1) - else () - message (FATAL_ERROR " **** thread support requires C11 threads, Win32 threads or Pthreads **** ") - endif () +if (HDF5_ENABLE_THREADS) + set (THREADS_PREFER_PTHREAD_FLAG ON) + find_package (Threads) + if (Threads_FOUND) + set (H5_HAVE_THREADS 1) + set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) + + # Determine which threading package to use + # Comment out check for C11 threads for now, since it conflicts with the + # current --std=c99 compile flags at configuration time. When we switch to + # --std=c11, this can be uncommented. + #CHECK_INCLUDE_FILE("threads.h" HAVE_THREADS_H) + if (WIN32) + # When Win32 is available, we use those threads + set (H5_HAVE_WIN_THREADS 1) + elseif (HAVE_THREADS_H) + # When C11 threads are available, those are the top choice + set (H5_HAVE_C11_THREADS 1) + elseif (CMAKE_USE_PTHREADS_INIT) + set (H5_HAVE_PTHREAD_H 1) + else () + message (FATAL_ERROR " **** thread support requires C11 threads, Win32 threads or Pthreads **** ") + endif () - # Check for compiler support for atomic variables - CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H) - if (HAVE_STDATOMIC_H) - set (H5_HAVE_STDATOMIC_H 1) - endif() -endif () + # Check for compiler support for atomic variables + CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC_H) + if (HAVE_STDATOMIC_H) + set (H5_HAVE_STDATOMIC_H 1) + endif() + endif () +endif() # Determine whether to build the HDF5 Subfiling VFD set (H5FD_SUBFILING_DIR ${HDF5_SRC_DIR}/H5FDsubfiling) From e448ca929d276840781319d19626b8fdc31b46e0 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Sun, 4 May 2025 10:44:17 -0500 Subject: [PATCH 2/2] chore: sync upstream --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 897e5386037..27b25422c12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,4 @@ cmake_minimum_required (VERSION 3.18) -# set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) -# set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) project (HDF5 C) if (POLICY CMP0074) @@ -566,6 +564,14 @@ endif () set (CMAKE_POSITION_INDEPENDENT_CODE ON) +#----------------------------------------------------------------------------- +# perl is used in some optional src and tests, check availability +find_package (Perl) +if (PERL_FOUND) + set (H5_PERL_FOUND YES) +endif () +#----------------------------------------------------------------------------- + #----------------------------------------------------------------------------- # Option to Build Static executables #-----------------------------------------------------------------------------