mirror of https://github.com/microsoft/vcpkg.git
[cgns] Update to 4.5.0, cleanup, fixes (#43386)
This commit is contained in:
parent
03590b42b5
commit
fa94ee97d3
|
|
@ -1,61 +1,51 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 60f9de4..e980ef7 100644
|
||||
index 8a400b8..6bc5d6c 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -261,51 +261,12 @@ if (CGNS_ENABLE_HDF5)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
@@ -261,7 +261,8 @@ endif ()
|
||||
option(CGNS_ENABLE_HDF5 "Enable or disable HDF5 interface" "ON")
|
||||
if (CGNS_ENABLE_HDF5)
|
||||
|
||||
- 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)
|
||||
- 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()
|
||||
-
|
||||
- set (FIND_HDF_COMPONENTS C ${CG_HDF5_LINK_TYPE})
|
||||
-
|
||||
- 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
|
||||
- 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)
|
||||
- set (CG_HDF5_LINK_TYPE "shared")
|
||||
- set (CG_HDF5_LINK_TYPE_UPPER "SHARED")
|
||||
- else ()
|
||||
- set (HDF5_BUILD_SHARED_LIBS 0)
|
||||
- set (CG_HDF5_LINK_TYPE "static")
|
||||
- set (CG_HDF5_LINK_TYPE_UPPER "STATIC")
|
||||
- endif ()
|
||||
- set (LINK_LIBS ${HDF5_LIBRARIES})
|
||||
+ find_package (HDF5 CONFIG REQUIRED)
|
||||
- if (CGNS_BUILD_SHARED)
|
||||
+ 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 ()
|
||||
- set (HDF5_PACKAGE_NAME ${SEARCH_PACKAGE_NAME})
|
||||
set (CG_HDF5_LINK_TYPE "shared")
|
||||
set (CG_HDF5_LINK_TYPE_UPPER "SHARED")
|
||||
else ()
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index f21eecb..fc3ad34 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -597,7 +597,7 @@ add_library(cgns_static STATIC ${cgns_FILES} $<$<BOOL:${CGNS_ENABLE_FORTRAN}>:$<
|
||||
add_library(CGNS::cgns-static ALIAS cgns_static)
|
||||
# Needed to work around a CMake > 3.8 bug on Windows with MSVS and Intel Fortran
|
||||
set_property(TARGET cgns_static PROPERTY LINKER_LANGUAGE C)
|
||||
-target_link_libraries(cgns_static PRIVATE $<$<BOOL:${CGNS_ENABLE_HDF5}>:hdf5-${CG_HDF5_LINK_TYPE}>)
|
||||
+target_link_libraries(cgns_static PRIVATE $<$<BOOL:${CGNS_ENABLE_HDF5}>:${HDF5_LIBRARY}>)
|
||||
|
||||
if (HDF5_FOUND)
|
||||
if (NOT DEFINED HDF5_INCLUDE_DIRS)
|
||||
# Build a shared version of the library
|
||||
if(CGNS_BUILD_SHARED)
|
||||
@@ -614,7 +614,7 @@ if(CGNS_BUILD_SHARED)
|
||||
target_compile_definitions(cgns_shared INTERFACE -DUSE_DLL)
|
||||
endif ()
|
||||
if (CGNS_ENABLE_HDF5 AND HDF5_LIBRARY)
|
||||
- target_link_libraries(cgns_shared PUBLIC hdf5-${CG_HDF5_LINK_TYPE} $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}>)
|
||||
+ target_link_libraries(cgns_shared PUBLIC ${HDF5_LIBRARY} $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}>)
|
||||
if(HDF5_NEED_ZLIB AND ZLIB_LIBRARY)
|
||||
target_link_libraries(cgns_shared PUBLIC ${ZLIB_LIBRARY})
|
||||
endif()
|
||||
diff --git a/src/cgns-config.cmake.in b/src/cgns-config.cmake.in
|
||||
index 12d9b17..23f2d99 100644
|
||||
--- a/src/cgns-config.cmake.in
|
||||
+++ b/src/cgns-config.cmake.in
|
||||
@@ -1,5 +1,10 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
+if("@CGNS_ENABLE_HDF5@")
|
||||
+ include(CMakeFindDependencyMacro)
|
||||
+ find_dependency(hdf5 CONFIG)
|
||||
+endif()
|
||||
+
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/cgns-targets.cmake")
|
||||
|
||||
check_required_components(cgns)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index fc3ad34..bef4944 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -697,6 +697,8 @@ endif()
|
||||
|
||||
set (install_targets cgns_static)
|
||||
if(CGNS_BUILD_SHARED)
|
||||
+ set_target_properties(${install_targets} PROPERTIES EXCLUDE_FROM_ALL 1)
|
||||
+ set(install_targets "")
|
||||
set(install_targets ${install_targets} cgns_shared)
|
||||
endif ()
|
||||
# Set the install path of the static and shared library
|
||||
|
|
@ -1,51 +1,53 @@
|
|||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO CGNS/CGNS
|
||||
REF "v${VERSION}"
|
||||
SHA512 86c16d40b524519362645c553c91bade9bb7e4bffde7bf4de96a7f471ae3779a15781efa91efa059b2af0b127f08a560d2e903df6b45e1c79eaec6061db226e9
|
||||
REF "v${VERSION}"
|
||||
SHA512 0286ff2faf9102e5fb6d9bed764fd553756d62ae9be9dbb8b37ba6e2d3a7fec9337715320ec38a001960e39d397e846f2adbd4b54930c20e0304edacdd48fc92
|
||||
HEAD_REF develop
|
||||
PATCHES
|
||||
hdf5.patch
|
||||
install-lib-linkage.diff
|
||||
linux_lfs.patch
|
||||
)
|
||||
|
||||
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
|
||||
"tests" CGNS_ENABLE_TESTS
|
||||
)
|
||||
|
||||
set(CGNS_BUILD_OPTS "")
|
||||
if(VCPKG_TARGET_ARCHITECTURE MATCHES "64")
|
||||
list(APPEND CGNS_BUILD_OPTS "-DCGNS_ENABLE_64BIT=ON")
|
||||
endif()
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" CGNS_BUILD_SHARED)
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
||||
list(APPEND CGNS_BUILD_OPTS "-DCGNS_BUILD_SHARED=ON;-DCGNS_USE_SHARED=ON")
|
||||
else()
|
||||
list(APPEND CGNS_BUILD_OPTS "-DCGNS_BUILD_SHARED=OFF;-DCGNS_USE_SHARED=OFF")
|
||||
endif()
|
||||
|
||||
# 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}
|
||||
-DCGNS_BUILD_SHARED=${CGNS_BUILD_SHARED}
|
||||
-DCGNS_ENABLE_SCOPING:BOOL=ON
|
||||
OPTIONS_RELEASE
|
||||
-DCMAKE_TRY_COMPILE_CONFIGURATION=Release
|
||||
OPTIONS_DEBUG
|
||||
-DCMAKE_TRY_COMPILE_CONFIGURATION=Debug
|
||||
)
|
||||
|
||||
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")
|
||||
|
||||
set(TOOLS "cgnsupdate")
|
||||
if("hdf5" IN_LIST FEATURES)
|
||||
list(APPEND TOOLS "adf2hdf" "hdf2adf")
|
||||
endif()
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
list(TRANSFORM TOOLS APPEND ".bat")
|
||||
endif()
|
||||
foreach(TOOL IN LISTS TOOLS)
|
||||
file(INSTALL "${CURRENT_PACKAGES_DIR}/bin/${TOOL}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
|
||||
file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/${TOOL}" "${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL}")
|
||||
endforeach()
|
||||
|
||||
vcpkg_copy_tools(
|
||||
TOOL_NAMES
|
||||
cgnscheck
|
||||
|
|
@ -57,28 +59,6 @@ vcpkg_copy_tools(
|
|||
AUTO_CLEAN
|
||||
)
|
||||
|
||||
set(TOOLS "cgnsupdate")
|
||||
if("hdf5" IN_LIST FEATURES)
|
||||
list(APPEND TOOLS "adf2hdf" "hdf2adf")
|
||||
endif()
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
list(TRANSFORM TOOLS APPEND ".bat")
|
||||
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()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS)
|
||||
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()
|
||||
|
||||
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
|
||||
|
||||
|
|
@ -86,5 +66,8 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/cgnslib.h" "defined(USE_DLL)" "1")
|
||||
endif()
|
||||
|
||||
# Handle copyright
|
||||
configure_file("${SOURCE_PATH}/license.txt" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/license.txt")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
cgns provides CMake targets:
|
||||
|
||||
find_package(cgns CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:CGNS::cgns_shared>,CGNS::cgns_shared,CGNS::cgns_static>)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cgns",
|
||||
"version-semver": "4.4.0",
|
||||
"version-semver": "4.5.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/",
|
||||
"license": "Zlib",
|
||||
|
|
@ -16,7 +16,10 @@
|
|||
],
|
||||
"default-features": [
|
||||
"hdf5",
|
||||
"lfsselector"
|
||||
{
|
||||
"name": "lfs",
|
||||
"platform": "!osx"
|
||||
}
|
||||
],
|
||||
"features": {
|
||||
"fortran": {
|
||||
|
|
@ -27,10 +30,7 @@
|
|||
"dependencies": [
|
||||
{
|
||||
"name": "hdf5",
|
||||
"default-features": false,
|
||||
"features": [
|
||||
"tools"
|
||||
]
|
||||
"default-features": false
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -40,22 +40,16 @@
|
|||
"lfs": {
|
||||
"description": "Enable LFS support"
|
||||
},
|
||||
"lfsselector": {
|
||||
"description": "Selector for LFS",
|
||||
"mpi": {
|
||||
"description": "Enable MPI support",
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "cgns",
|
||||
"default-features": false,
|
||||
"features": [
|
||||
"lfs"
|
||||
],
|
||||
"platform": "!osx"
|
||||
}
|
||||
]
|
||||
},
|
||||
"mpi": {
|
||||
"description": "Enable MPI support",
|
||||
"dependencies": [
|
||||
"hdf5"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "hdf5",
|
||||
"default-features": false,
|
||||
|
|
@ -67,9 +61,6 @@
|
|||
},
|
||||
"tests": {
|
||||
"description": "Build tests"
|
||||
},
|
||||
"tools": {
|
||||
"description": "No effects, preserved for upgrade compatibility"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1585,7 +1585,7 @@
|
|||
"port-version": 0
|
||||
},
|
||||
"cgns": {
|
||||
"baseline": "4.4.0",
|
||||
"baseline": "4.5.0",
|
||||
"port-version": 0
|
||||
},
|
||||
"chaiscript": {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "f537ae051f9af88c9573cad36c9f7d5cfa20d570",
|
||||
"version-semver": "4.5.0",
|
||||
"port-version": 0
|
||||
},
|
||||
{
|
||||
"git-tree": "3888323fcc200e6d78c882a04c0604acd8281084",
|
||||
"version-semver": "4.4.0",
|
||||
|
|
|
|||
Loading…
Reference in New Issue