diff --git a/.azure-pipelines/azure-pipelines-osx.yml b/.azure-pipelines/azure-pipelines-osx.yml index f1712cd..a6548f9 100755 --- a/.azure-pipelines/azure-pipelines-osx.yml +++ b/.azure-pipelines/azure-pipelines-osx.yml @@ -5,7 +5,7 @@ jobs: - job: osx pool: - vmImage: macOS-12 + vmImage: macOS-13 strategy: matrix: osx_64_mpimpich: diff --git a/.ci_support/win_64_mpiimpi.yaml b/.ci_support/win_64_mpiimpi.yaml index 2e1fd04..89aedb9 100644 --- a/.ci_support/win_64_mpiimpi.yaml +++ b/.ci_support/win_64_mpiimpi.yaml @@ -3,11 +3,15 @@ c_compiler: c_stdlib: - vs channel_sources: -- conda-forge +- conda-forge/label/llvm_rc,conda-forge channel_targets: - conda-forge main cxx_compiler: - vs2019 +fortran_compiler: +- flang +fortran_compiler_version: +- '19' hdf5: - 1.14.3 libaec: diff --git a/.ci_support/win_64_mpinompi.yaml b/.ci_support/win_64_mpinompi.yaml index 9c0136f..d3bd9ec 100644 --- a/.ci_support/win_64_mpinompi.yaml +++ b/.ci_support/win_64_mpinompi.yaml @@ -3,11 +3,15 @@ c_compiler: c_stdlib: - vs channel_sources: -- conda-forge +- conda-forge/label/llvm_rc,conda-forge channel_targets: - conda-forge main cxx_compiler: - vs2019 +fortran_compiler: +- flang +fortran_compiler_version: +- '19' hdf5: - 1.14.3 libaec: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e5306da..32da3d0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,7 +2,32 @@ # update the conda-forge.yml and/or the recipe/meta.yaml. # -*- mode: yaml -*- -jobs: - - template: ./.azure-pipelines/azure-pipelines-linux.yml - - template: ./.azure-pipelines/azure-pipelines-osx.yml - - template: ./.azure-pipelines/azure-pipelines-win.yml \ No newline at end of file +stages: +- stage: Check + jobs: + - job: Skip + pool: + vmImage: 'ubuntu-22.04' + variables: + DECODE_PERCENTS: 'false' + RET: 'true' + steps: + - checkout: self + fetchDepth: '2' + - bash: | + git_log=`git log --max-count=1 --skip=1 --pretty=format:"%B" | tr "\n" " "` + echo "##vso[task.setvariable variable=log]$git_log" + displayName: Obtain commit message + - bash: echo "##vso[task.setvariable variable=RET]false" + condition: or(contains(variables.log, '[skip azp]'), contains(variables.log, '[azp skip]'), contains(variables.log, '[skip ci]'), contains(variables.log, '[ci skip]')) + displayName: Skip build? + - bash: echo "##vso[task.setvariable variable=start_main;isOutput=true]$RET" + name: result + displayName: Export result +- stage: Build + condition: and(succeeded(), eq(dependencies.Check.outputs['Skip.result.start_main'], 'true')) + dependsOn: Check + jobs: + - template: ./.azure-pipelines/azure-pipelines-linux.yml + - template: ./.azure-pipelines/azure-pipelines-osx.yml + - template: ./.azure-pipelines/azure-pipelines-win.yml \ No newline at end of file diff --git a/recipe/bld-flang.bat b/recipe/bld-flang.bat new file mode 100644 index 0000000..9bfc668 --- /dev/null +++ b/recipe/bld-flang.bat @@ -0,0 +1,88 @@ +@echo on +setlocal EnableDelayedExpansion + +mkdir build +cd build + +REM set clanglibdir=%CONDA_PREFIX:\=/%/lib/clang/19/lib/windows +REM copy "%clanglibdir%\clang_rt.builtins-x86_64.lib" "%LIBRARY_LIB%\clang_rt.builtins.lib" + +:: Set environment variables. +set HDF5_EXT_ZLIB=zlib.lib + +:: temporarily vendor flang compiler activation +set "FC=flang-new" +set "CC=clang-cl" +set "CXX=clang-cl" + +:: need to read clang version for path to compiler-rt +FOR /F "tokens=* USEBACKQ" %%F IN (`clang.exe -dumpversion`) DO ( + SET "CLANG_VER=%%F" +) +set "FFLAGS=-D_CRT_SECURE_NO_WARNINGS -D_MT -D_DLL --target=x86_64-pc-windows-msvc" +set "LDFLAGS=--target=x86_64-pc-windows-msvc -fms-runtime-lib=dll -fuse-ld=lld" +set "LDFLAGS=%LDFLAGS% -Wl,-defaultlib:%BUILD_PREFIX%/Library/lib/clang/!CLANG_VER:~0,2!/lib/windows/clang_rt.builtins-x86_64.lib" + + +set "CXXFLAGS=%CXXFLAGS% -LTCG" +if "%mpi%"=="impi" ( + :: cmake generates syntax errors if there are backslashes in paths + set _LIBRARY=%LIBRARY_PREFIX:\=/% + set "CMAKE_ARGS=!CMAKE_ARGS! -D MPI_C_ADDITIONAL_INCLUDE_DIRS:PATH=!_LIBRARY!/include" + set "CMAKE_ARGS=!CMAKE_ARGS! -D MPI_CXX_ADDITIONAL_INCLUDE_DIRS:PATH=!_LIBRARY!/include" + set "CMAKE_ARGS=!CMAKE_ARGS! -D MPI_C_LIB_NAMES=IMPI" + set "CMAKE_ARGS=!CMAKE_ARGS! -D MPI_CXX_LIB_NAMES=IMPI" + set "CMAKE_ARGS=!CMAKE_ARGS! -D MPI_IMPI_LIBRARY:PATH=!_LIBRARY!/lib/impi.lib" + set "CMAKE_ARGS=!CMAKE_ARGS! -D MPI_ASSUME_NO_BUILTIN_MPI=ON" + set "CMAKE_ARGS=!CMAKE_ARGS! -D MPI_SKIP_COMPILER_WRAPPER=ON" + set "CMAKE_ARGS=!CMAKE_ARGS! -D MPI_SKIP_GUESSING=ON" + set "CMAKE_ARGS=!CMAKE_ARGS! -D HDF5_ENABLE_PARALLEL:BOOL=ON" +) + +echo "CMAKE_ARGS=!CMAKE_ARGS!" + +:: Configure step. +cmake -G "Ninja" ^ + !CMAKE_ARGS! ^ + -D CMAKE_BUILD_TYPE:STRING=RELEASE ^ + -D CMAKE_PREFIX_PATH:PATH=%LIBRARY_PREFIX% ^ + -D CMAKE_INSTALL_PREFIX:PATH=%LIBRARY_PREFIX% ^ + -D CMAKE_Fortran_COMPILER:STRING=%FC% ^ + -D HDF5_BUILD_CPP_LIB:BOOL=ON ^ + -D CMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON ^ + -D BUILD_SHARED_LIBS:BOOL=ON ^ + -D BUILD_STATIC_LIBS:BOOL=OFF ^ + -D ONLY_SHARED_LIBS:BOOL=ON ^ + -D HDF5_BUILD_HL_LIB:BOOL=ON ^ + -D HDF5_BUILD_TOOLS:BOOL=ON ^ + -D HDF5_BUILD_FORTRAN:BOOL=ON ^ + -D HDF5_BUILD_HL_GIF_TOOLS:BOOL=ON ^ + -D HDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON ^ + -D HDF5_ENABLE_THREADSAFE:BOOL=ON ^ + -D HDF5_ENABLE_ROS3_VFD:BOOL=ON ^ + -D HDF5_ENABLE_SZIP_SUPPORT=ON ^ + -D ALLOW_UNSUPPORTED:BOOL=ON ^ + %SRC_DIR% + +if errorlevel 1 ( + dir CMakeFiles + type CMakeFiles\CMakeOutput.log + type CMakeFiles\CMakeError.log + type CMakeFiles\CMakeConfigureLog.yaml + exit /b 1 +) + +:: Build C libraries and tools. +ninja +if errorlevel 1 exit 1 + +:: Install step. +ninja install +if errorlevel 1 exit 1 + +:: Remove extraneous COPYING file that gets installed automatically +:: https://github.com/conda-forge/hdf5-feedstock/issues/87 +del /f %PREFIX%\Library\COPYING +if errorlevel 1 exit 1 +del /f %PREFIX%\Library\RELEASE.txt +if errorlevel 1 exit 1 diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index d236281..dae9a00 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -2,4 +2,12 @@ mpi: - nompi - impi # [win] - mpich # [unix] - - openmpi # [unix] \ No newline at end of file + - openmpi # [unix] + +channel_sources: +- conda-forge/label/llvm_rc,conda-forge # [win] + +fortran_compiler: # [win] +- flang # [win] +fortran_compiler_version: # [win] +- '19' # [win] \ No newline at end of file diff --git a/recipe/meta.yaml b/recipe/meta.yaml index f06ed2c..c16c918 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -53,10 +53,12 @@ source: - patches/0002-run-host-H5detect-when-cross-compiling.patch # [osx and build_platform != target_platform] # Fix operator= (https://github.com/HDFGroup/hdf5/pull/4473) - patches/ea760136.patch + - patches/fix_flang_flags.patch # [win] build: number: {{ build }} string: {{ mpi_prefix }}_h{{ PKG_HASH }}_{{ build }} + script: '{{ RECIPE_DIR}}/bld-flang.bat' # [win] run_exports: - {{ pin_subpackage('hdf5', max_pin='x.x.x') }} {{ build_pin }} @@ -67,7 +69,7 @@ requirements: - {{ compiler('c') }} - {{ stdlib('c') }} - {{ compiler('cxx') }} - - {{ compiler('fortran') }} # [not win] + - {{ compiler('fortran') }} - cmake # [win] - automake # [not win] - autoconf # [not win] diff --git a/recipe/patches/fix_flang_flags.patch b/recipe/patches/fix_flang_flags.patch new file mode 100644 index 0000000..d03e1e3 --- /dev/null +++ b/recipe/patches/fix_flang_flags.patch @@ -0,0 +1,25 @@ +Subject: [PATCH] fix flang flags +--- +Index: config/cmake/ConfigureChecks.cmake +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake +--- a/config/cmake/ConfigureChecks.cmake (revision 4041d6f34ffa4630cfb60ce1f42b6cb9ab715a6b) ++++ b/config/cmake/ConfigureChecks.cmake (date 1713426546921) +@@ -61,7 +61,13 @@ + if (WIN32 AND NOT MINGW) + if (NOT UNIX) + set (WINDOWS 1) +- set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") ++ # IF CMAKE_Fortran_COMPILER contains ++ if (CMAKE_Fortran_COMPILER MATCHES "flang") ++ message(STATUS "Using flang-new compiler") ++ set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") ++ else () ++ set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1") ++ endif () + if (MSVC) + set (${HDF_PREFIX}_HAVE_VISUAL_STUDIO 1) + endif ()