Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cgns] Update to 4.3.0 #24531

Merged
merged 10 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 31 additions & 58 deletions ports/cgns/hdf5.patch
Original file line number Diff line number Diff line change
@@ -1,88 +1,61 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d871a9dc8..d2c631023 100644
index 60f9de4..e980ef7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -232,46 +232,12 @@ if (CGNS_ENABLE_HDF5)
@@ -261,51 +261,12 @@ if (CGNS_ENABLE_HDF5)
cmake_policy(SET CMP0074 NEW)
endif()

- find_package (HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS ${FIND_HDF_COMPONENTS})
- message (STATUS "HDF5 C libs:${HDF5_FOUND} static:${HDF5_static_C_FOUND} and shared:${HDF5_shared_C_FOUND}")
- if (HDF5_FOUND)
- if (NOT HDF5_static_C_FOUND AND NOT HDF5_shared_C_FOUND)
- set (FIND_HDF_COMPONENTS C)
- if (CG_HDF5_LINK_TYPE STREQUAL "shared")
- set(CG_HDF5_LINK_TYPE "static")
- set(CG_HDF5_LINK_TYPE_UPPER "STATIC")
- else()
- set(CG_HDF5_LINK_TYPE "shared")
- set(CG_HDF5_LINK_TYPE_UPPER "SHARED")
- endif()
-
- find_package (HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS ${FIND_HDF_COMPONENTS})
- message (STATUS "HDF5 libs:${HDF5_FOUND} C:${HDF5_C_FOUND}")
- set (LINK_LIBS ${LINK_LIBS} ${HDF5_LIBRARIES})
- if (HDF5_BUILD_SHARED_LIBS)
- add_definitions (-DH5_BUILT_AS_DYNAMIC_LIB)
- else (HDF5_BUILD_SHARED_LIBS)
- add_definitions (-DH5_BUILT_AS_STATIC_LIB)
- endif (HDF5_BUILD_SHARED_LIBS)
- else (NOT HDF5_static_C_FOUND AND NOT HDF5_shared_C_FOUND)
- if (CGNS_BUILD_SHARED AND HDF5_shared_C_FOUND)
- set (LINK_LIBS ${LINK_LIBS} ${HDF5_C_SHARED_LIBRARY})
- else (CGNS_BUILD_SHARED AND HDF5_shared_C_FOUND)
- set (LINK_LIBS ${LINK_LIBS} ${HDF5_C_STATIC_LIBRARY})
- endif (CGNS_BUILD_SHARED AND HDF5_shared_C_FOUND)
- endif (NOT HDF5_static_C_FOUND AND NOT HDF5_shared_C_FOUND)
- set (FIND_HDF_COMPONENTS C ${CG_HDF5_LINK_TYPE})
-
- else (HDF5_FOUND)
- find_package (HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS ${FIND_HDF_COMPONENTS} REQUIRED)
- message (STATUS "HDF5 libs:${HDF5_FOUND} C:${HDF5_C_${CG_HDF5_LINK_TYPE_UPPER}_LIBRARY}")
- endif()
-
- set(LINK_LIBS ${HDF5_C_${CG_HDF5_LINK_TYPE_UPPER}_LIBRARY})
- else ()
- find_package (HDF5) # Legacy find
-
- #Legacy find_package does not set HDF5_TOOLS_DIR, so we set it here
- set(HDF5_TOOLS_DIR ${HDF5_LIBRARY}/../bin)
-
- #Legacy find_package does not set HDF5_BUILD_SHARED_LIBS, so we set it here
- if (CGNS_BUILD_SHARED AND EXISTS "${HDF5_LIBRARY}/libhdf5${CMAKE_SHARED_LIBRARY_SUFFIX}")
- set(GUESS_SHARED "${HDF5_LIBRARY}/libhdf5${CMAKE_SHARED_LIBRARY_SUFFIX}")
- foreach (ITEM ${HDF5_LIBRARIES})
- if (ITEM MATCHES "(.*)hdf5${CMAKE_SHARED_LIBRARY_SUFFIX}")
- set(GUESS_SHARED "${ITEM}")
- break()
- endif()
- endforeach()
- if (CGNS_BUILD_SHARED AND EXISTS "${GUESS_SHARED}")
- set (HDF5_BUILD_SHARED_LIBS 1)
- add_definitions (-DH5_BUILT_AS_DYNAMIC_LIB)
- set (CG_HDF5_LINK_TYPE "shared")
- set (CG_HDF5_LINK_TYPE_UPPER "SHARED")
- else ()
- set (HDF5_BUILD_SHARED_LIBS 0)
- add_definitions (-DH5_BUILT_AS_STATIC_LIB)
- set (CG_HDF5_LINK_TYPE "static")
- set (CG_HDF5_LINK_TYPE_UPPER "STATIC")
- endif ()
- set (LINK_LIBS ${LINK_LIBS} ${HDF5_LIBRARIES})
-
- endif (HDF5_FOUND)
- set (HDF5_PACKAGE_NAME ${SEARCH_PACKAGE_NAME})
- set (LINK_LIBS ${HDF5_LIBRARIES})
+ find_package (HDF5 CONFIG REQUIRED)
+ if (TARGET hdf5::hdf5-shared)
+ set (LINK_LIBS ${LINK_LIBS} hdf5::hdf5-shared)
+ else ()
+ set (LINK_LIBS ${LINK_LIBS} hdf5::hdf5-static)
+ endif ()
endif ()
- set (HDF5_PACKAGE_NAME ${SEARCH_PACKAGE_NAME})

if (HDF5_FOUND)
if (NOT DEFINED HDF5_INCLUDE_DIRS)
@@ -289,20 +255,10 @@ if (CGNS_ENABLE_HDF5)
endif (HDF5_FOUND)

set(HDF5_NEED_ZLIB "OFF" CACHE BOOL "Does the HDF5 library require linking to zlib?")
- if(HDF5_NEED_ZLIB)
- find_library(ZLIB_LIBRARY z)
- mark_as_advanced(CLEAR ZLIB_LIBRARY)
- else (HDF5_NEED_ZLIB)
- mark_as_advanced(FORCE ZLIB_LIBRARY)
- endif(HDF5_NEED_ZLIB)
+ set(HDF5_NEED_ZLIB ${HDF5_ENABLE_Z_LIB_SUPPORT} CACHE INTERNAL "" FORCE)

set(HDF5_NEED_SZIP "OFF" CACHE BOOL "Does the HDF5 library require linking to szip?")
- if (HDF5_NEED_SZIP)
- find_library(SZIP_LIBRARY szip)
- mark_as_advanced(CLEAR SZIP_LIBRARY)
- else (HDF5_NEED_SZIP)
- mark_as_advanced(FORCE SZIP_LIBRARY)
- endif (HDF5_NEED_SZIP)
+ set(HDF5_NEED_SZIP ${HDF5_ENABLE_SZIP_SUPPORT} CACHE INTERNAL "" FORCE)

# Check if HDF5 version is 1.8 or greater
if (HDF5_VERSION VERSION_LESS "1.8.0")
@@ -310,6 +266,7 @@ if (CGNS_ENABLE_HDF5)
endif (HDF5_VERSION VERSION_LESS "1.8.0")

set(HDF5_NEED_MPI "OFF" CACHE BOOL "Does the HDF5 library require linking to mpi? (Only true if using parallel HDF5)")
+ set(HDF5_NEED_MPI ${HDF5_ENABLE_PARALLEL} CACHE INTERNAL "" FORCE)
set(MPI_INC)
set(MPI_LIBS)
if (HDF5_NEED_MPI)
8 changes: 4 additions & 4 deletions ports/cgns/linux_lfs.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
index 46446da8a..a3d8cd98f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,6 +82,7 @@ if (CGNS_ENABLE_LFS)
else (WIN32)
@@ -116,6 +116,7 @@ if (CGNS_ENABLE_LFS)
else ()
check_symbol_exists(open64 "sys/types.h;sys/stat.h;unistd.h" HAVE_OPEN64)
check_symbol_exists(lseek64 "sys/types.h;unistd.h" HAVE_LSEEK64)
+ add_definitions(-D_FILE_OFFSET_BITS=64 -D__LARGEFILE64_SOURCE -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE)
panda-z marked this conversation as resolved.
Show resolved Hide resolved
endif (WIN32)
endif ()
if (HAVE_OPEN64)
add_definitions(-DHAVE_OPEN64)
add_compile_definitions(HAVE_OPEN64)
139 changes: 95 additions & 44 deletions ports/cgns/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO CGNS/CGNS
REF 86b686bce292eef7782cfb56b6acdb5123c96f49 # v4.2.0
SHA512 88df741acc1b650724bcbeb82ab0f7e593bf01e0a30c04b14b9915f4ea4331725cc24b87715dd08d93d5a3708660ca7f7874bc0a9c5505b76471802cf033e35d
REF ec538ac11dbaff510464a831ef094b0d6bf7216c # v4.3.0
SHA512 3c04829ff99c0f4f1cd705f0807fda0a65f970c7eecd23ec624cf09fb6fa2a566c63fc94d46c1d0754910bbff8f98c3723e4f32ef66c3e7e41930313454fa10b
HEAD_REF develop
PATCHES
hdf5.patch
Expand All @@ -12,13 +12,15 @@ vcpkg_from_github(

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
fortran CGNS_ENABLE_FORTRAN
tests CGNS_ENABLE_TESTS
hdf5 CGNS_ENABLE_HDF5
lfs CGNS_ENABLE_LFS
legacy CGNS_ENABLE_LEGACY
"fortran" CGNS_ENABLE_FORTRAN
"tests" CGNS_ENABLE_TESTS
"hdf5" CGNS_ENABLE_HDF5
"lfs" CGNS_ENABLE_LFS
"legacy" CGNS_ENABLE_LEGACY
"cgnstools" CGNS_BUILD_CGNSTOOLS
)

set(CGNS_BUILD_OPTS "")
if(VCPKG_TARGET_ARCHITECTURE MATCHES "64")
list(APPEND CGNS_BUILD_OPTS "-DCGNS_ENABLE_64BIT=ON")
endif()
Expand All @@ -29,54 +31,103 @@ else()
list(APPEND CGNS_BUILD_OPTS "-DCGNS_BUILD_SHARED=OFF;-DCGNS_USE_SHARED=OFF")
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA # Disable this option if project cannot be built with Ninja
OPTIONS
# By default, when possible, vcpkg_cmake_configure uses ninja-build as its build system
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
${CGNS_BUILD_OPTS}
)

vcpkg_install_cmake()

file(INSTALL ${CURRENT_PACKAGES_DIR}/include/cgnsBuild.defs DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(REMOVE ${CURRENT_PACKAGES_DIR}/include/cgnsBuild.defs ${CURRENT_PACKAGES_DIR}/include/cgnsconfig.h)

file(INSTALL ${CURRENT_PORT_DIR}/cgnsconfig.h DESTINATION ${CURRENT_PACKAGES_DIR}/include) # the include is all that is needed
vcpkg_cmake_install()
vcpkg_copy_pdbs()

# Moves all *.cmake files from /debug/lib/cmake/cgns/ to /share/cgns/
# See /docs/maintainers/ports/vcpkg-cmake-config/vcpkg_cmake_config_fixup.md for more details
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/cgns")

vcpkg_copy_tools(
TOOL_NAMES
cgnscheck
cgnscompress
cgnsconvert
cgnsdiff
cgnslist
cgnsnames
AUTO_CLEAN
)

set(TOOLS cgnscheck cgnscompress cgnsconvert cgnsdiff cgnslist cgnsnames)
if(VCPKG_TARGET_IS_WINDOWS)
set(TOOLS "adf2hdf.bat" "hdf2adf.bat" "cgnsupdate.bat")
elseif(VCPKG_TARGET_IS_LINUX)
set(TOOLS "adf2hdf" "hdf2adf" "cgnsupdate")
endif()

foreach(tool ${TOOLS})
set(suffix ${VCPKG_TARGET_EXECUTABLE_SUFFIX})
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/bin/${tool}${suffix}")
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/${tool}${suffix}")
endif()
if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/${tool}${suffix}")
file(INSTALL "${CURRENT_PACKAGES_DIR}/bin/${tool}${suffix}"
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/${tool}${suffix}")
endif()
foreach(TOOL ${TOOLS})
file(INSTALL "${CURRENT_PACKAGES_DIR}/bin/${TOOL}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/${TOOL}")
endforeach()

vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})

IF(EXISTS ${CURRENT_PACKAGES_DIR}/debug)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/include/cgnsBuild.defs ${CURRENT_PACKAGES_DIR}/debug/include/cgnsconfig.h)
if("cgnstools" IN_LIST FEATURES)
vcpkg_copy_tools(
TOOL_NAMES
calcwish
plotwish
cgiowish
aflr3_to_cgns
cgns_info
cgns_to_aflr3
cgns_to_fast
cgns_to_plot3d
cgns_to_tecplot
cgns_to_vtk
convert_dataclass
convert_location
convert_variables
extract_subset
fast_to_cgns
interpolate_cgns
patran_to_cgns
plot3d_to_cgns
tecplot_to_cgns
tetgen_to_cgns
update_ngon
vgrid_to_cgns
AUTO_CLEAN
)

if(VCPKG_TARGET_IS_WINDOWS)
# Copy tools from "bin" to "tools/cgns"
set(CGNSTOOLS "cgconfig.bat" "cgnscalc.bat" "unitconv.bat" "cgnsview.bat" "cgnsplot.bat" "cgnsnodes.bat")
foreach(CGNSTOOL IN LISTS CGNSTOOLS)
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/${CGNSTOOL}" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/${CGNSTOOL}")
endforeach()

# Adjust paths in batch file
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/cgconfig.bat" "${CURRENT_PACKAGES_DIR}\\bin" "${CURRENT_PACKAGES_DIR}\\tools\\cgns")
elseif(VCPKG_TARGET_IS_LINUX)
# Copy tools from "bin" to "tools/cgns"
set(CGNSTOOLS "cgconfig" "cgnscalc.sh" "unitconv.sh" "cgnsview.sh" "cgnsplot.sh" "cgnsnodes.sh")
foreach(CGNSTOOL IN LISTS CGNSTOOLS)
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/${CGNSTOOL}" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/${CGNSTOOL}")
endforeach()

# adjust paths in batch files
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/cgconfig" "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/tools/cgns")
endif()
endif()

file(REMOVE ${CURRENT_PACKAGES_DIR}/include/cgnsBuild.defs ${CURRENT_PACKAGES_DIR}/include/cgnsconfig.h)
file(GLOB_RECURSE BATCH_FILES ${CURRENT_PACKAGES_DIR}/bin/*.bat)

vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" "${CURRENT_PACKAGES_DIR}/bin")
endif()

if (EXISTS "${CURRENT_PACKAGES_DIR}/debug")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
endif()

# # Moves all .cmake files from /debug/share/cgns/ to /share/cgns/
# # See /docs/maintainers/vcpkg_fixup_cmake_targets.md for more details
# vcpkg_fixup_cmake_targets(CONFIG_PATH cmake TARGET_PATH share/cgns)
file(REMOVE "${CURRENT_PACKAGES_DIR}/include/cgnsBuild.defs" "${CURRENT_PACKAGES_DIR}/include/cgnsconfig.h")
file(INSTALL "${CURRENT_PORT_DIR}/cgnsconfig.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include") # the include is all that is needed

# # Handle copyright
file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
# Handle copyright
configure_file("${SOURCE_PATH}/license.txt" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
16 changes: 12 additions & 4 deletions ports/cgns/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
{
"name": "cgns",
"version-semver": "4.2.0",
"version-semver": "4.3.0",
"description": "The CFD General Notation System (CGNS) provides a standard for recording and recovering computer data associated with the numerical solution of fluid dynamics equations.",
"homepage": "http://cgns.org/",
"default-features": [
"hdf5",
"lfsselector"
],
"features": {
"cgnstools": {
"description": "Build cgnstools"
},
"fortran": {
"description": "Enable fortran support (not yet implemented)"
panda-z marked this conversation as resolved.
Show resolved Hide resolved
},
Expand All @@ -20,6 +23,14 @@
"features": [
"tools"
]
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
},
Expand Down Expand Up @@ -56,9 +67,6 @@
},
"tests": {
panda-z marked this conversation as resolved.
Show resolved Hide resolved
"description": "Build tests"
},
"tools": {
panda-z marked this conversation as resolved.
Show resolved Hide resolved
"description": "Build tools"
}
}
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@
"port-version": 0
},
"cgns": {
"baseline": "4.2.0",
"baseline": "4.3.0",
"port-version": 0
},
"chaiscript": {
Expand Down
5 changes: 5 additions & 0 deletions versions/c-/cgns.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e3f1a59904e8eb5354178b04001c9248249fa846",
"version-semver": "4.3.0",
"port-version": 0
},
{
"git-tree": "9d33908ce58fbfa6e823c937716e57d84d1cb2a5",
"version-semver": "4.2.0",
Expand Down