@@ -138,7 +138,7 @@ set(camp_SOURCES
138138 sub_models/sub_model_UNIFAC.c
139139 sub_models/sub_model_UNIFAC.F90
140140 sub_models/sub_model_ZSR_aerosol_water.F90
141- sub_models/sub_model_ZSR_aerosol_water.c
141+ sub_models/sub_model_ZSR_aerosol_water.c
142142)
143143add_prefix(gitmodules/camp/src/ camp_SOURCES)
144144
@@ -328,6 +328,8 @@ add_prefix(sundials_ SUNDIALS_items)
328328### CAMP ###########################################################################################
329329
330330add_library (camplib STATIC ${camp_SOURCES} ${json_fortran_SOURCES} )
331+ target_compile_options (camplib PRIVATE $<$<COMPILE_LANGUAGE:C>:-std=c99>)
332+ target_compile_definitions (camplib PRIVATE $<$<COMPILE_LANGUAGE:C>:__bool_true_false_are_defined>)
331333target_compile_definitions (camplib PRIVATE CAMP_USE_JSON="1" )
332334target_compile_definitions (camplib PRIVATE CAMP_USE_SUNDIALS="1" )
333335target_include_directories (camplib PRIVATE
@@ -353,9 +355,15 @@ set(HDF5_BUILD_TOOLS OFF)
353355set (HDF5_BUILD_EXAMPLES OFF )
354356set (HDF5_ENABLE_Z_LIB_SUPPORT OFF )
355357set (HDF5_ENABLE_SZIP_SUPPORT OFF )
358+ set (HDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16 OFF )
356359
357360add_subdirectory (${CMAKE_SOURCE_DIR} /gitmodules/hdf5)
358361
362+ if (MINGW)
363+ # https://github.com/HDFGroup/hdf5/issues/5885
364+ target_compile_definitions (hdf5-static PRIVATE _GNU_SOURCE)
365+ endif ()
366+
359367foreach (file ${hdf5_GENERATED_HEADERS} )
360368 execute_process (
361369 COMMAND ${PYTHON_EXECUTABLE} "-c" "import re;open(1,'wb').write(re.sub(b'\\ r',b'',open(0,'rb').read()))"
@@ -437,6 +445,20 @@ target_compile_definitions(netcdf_clib PRIVATE
437445 USE_NETCDF4
438446 USE_HDF5
439447)
448+ if (MINGW)
449+ file (WRITE "${CMAKE_BINARY_DIR} /fix_mingw_wstat64.h" "
450+ #pragma once
451+ #include <sys/stat.h>
452+ #ifdef _WIN64
453+ # undef _wstat64
454+ # define _wstat64(path, buf) _wstat64((path), (struct _stat64*)(buf))
455+ #endif
456+ " )
457+ target_compile_options (netcdf_clib PRIVATE
458+ -include ${CMAKE_BINARY_DIR} /fix_mingw_wstat64.h
459+ )
460+ endif ()
461+
440462target_compile_options (netcdf_clib PRIVATE
441463 $<$<C_COMPILER_ID:GNU>:-Wno-unused-result -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast>
442464 $<$<C_COMPILER_ID:AppleClang>:-Wno-pointer-to-int-cast -Wno-int-to-void-pointer-cast>
0 commit comments