diff options
Diffstat (limited to 'vcpkg/ports/cgns')
| -rw-r--r-- | vcpkg/ports/cgns/cgnsconfig.h | 6 | ||||
| -rw-r--r-- | vcpkg/ports/cgns/hdf5.patch | 51 | ||||
| -rw-r--r-- | vcpkg/ports/cgns/install-lib-linkage.diff | 13 | ||||
| -rw-r--r-- | vcpkg/ports/cgns/linux_lfs.patch | 12 | ||||
| -rw-r--r-- | vcpkg/ports/cgns/portfile.cmake | 73 | ||||
| -rw-r--r-- | vcpkg/ports/cgns/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/cgns/vcpkg.json | 67 |
7 files changed, 226 insertions, 0 deletions
diff --git a/vcpkg/ports/cgns/cgnsconfig.h b/vcpkg/ports/cgns/cgnsconfig.h new file mode 100644 index 0000000..7ebe18a --- /dev/null +++ b/vcpkg/ports/cgns/cgnsconfig.h @@ -0,0 +1,6 @@ +#ifndef CGNSCONFIG_H
+#define CGNSCONFIG_H
+
+#include "cgnstypes.h"
+
+#endif
\ No newline at end of file diff --git a/vcpkg/ports/cgns/hdf5.patch b/vcpkg/ports/cgns/hdf5.patch new file mode 100644 index 0000000..4015cfb --- /dev/null +++ b/vcpkg/ports/cgns/hdf5.patch @@ -0,0 +1,51 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8a400b8..6bc5d6c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -261,7 +261,8 @@ endif () + option(CGNS_ENABLE_HDF5 "Enable or disable HDF5 interface" "ON") + if (CGNS_ENABLE_HDF5) + +- if (CGNS_BUILD_SHARED) ++ find_package(hdf5 CONFIG REQUIRED) ++ if (TARGET hdf5::hdf5-shared) + 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}>) + + # 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) diff --git a/vcpkg/ports/cgns/install-lib-linkage.diff b/vcpkg/ports/cgns/install-lib-linkage.diff new file mode 100644 index 0000000..8aa37af --- /dev/null +++ b/vcpkg/ports/cgns/install-lib-linkage.diff @@ -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 diff --git a/vcpkg/ports/cgns/linux_lfs.patch b/vcpkg/ports/cgns/linux_lfs.patch new file mode 100644 index 0000000..af3d411 --- /dev/null +++ b/vcpkg/ports/cgns/linux_lfs.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 46446da8a..a3d8cd98f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -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) + endif () + if (HAVE_OPEN64) + add_compile_definitions(HAVE_OPEN64) diff --git a/vcpkg/ports/cgns/portfile.cmake b/vcpkg/ports/cgns/portfile.cmake new file mode 100644 index 0000000..045b623 --- /dev/null +++ b/vcpkg/ports/cgns/portfile.cmake @@ -0,0 +1,73 @@ +vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO CGNS/CGNS
+ 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
+ "hdf5" CGNS_ENABLE_HDF5
+ "lfs" CGNS_ENABLE_LFS
+ "legacy" CGNS_ENABLE_LEGACY
+ "tests" CGNS_ENABLE_TESTS
+)
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" CGNS_BUILD_SHARED)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -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()
+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
+ cgnscompress
+ cgnsconvert
+ cgnsdiff
+ cgnslist
+ cgnsnames
+ AUTO_CLEAN
+)
+
+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
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/cgnslib.h" "defined(USE_DLL)" "1")
+endif()
+
+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")
diff --git a/vcpkg/ports/cgns/usage b/vcpkg/ports/cgns/usage new file mode 100644 index 0000000..ebe4412 --- /dev/null +++ b/vcpkg/ports/cgns/usage @@ -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>) diff --git a/vcpkg/ports/cgns/vcpkg.json b/vcpkg/ports/cgns/vcpkg.json new file mode 100644 index 0000000..18c7f7c --- /dev/null +++ b/vcpkg/ports/cgns/vcpkg.json @@ -0,0 +1,67 @@ +{ + "name": "cgns", + "version-semver": "4.5.0", + "port-version": 1, + "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": "https://cgns.org/", + "license": "Zlib", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "hdf5", + { + "name": "lfs", + "platform": "!osx" + } + ], + "features": { + "fortran": { + "description": "Enable fortran support (not yet implemented)" + }, + "hdf5": { + "description": "Enable hdf5 support", + "dependencies": [ + { + "name": "hdf5", + "default-features": false + } + ] + }, + "legacy": { + "description": "Enable legacy support" + }, + "lfs": { + "description": "Enable LFS support" + }, + "mpi": { + "description": "Enable MPI support", + "dependencies": [ + { + "name": "cgns", + "default-features": false, + "features": [ + "hdf5" + ] + }, + { + "name": "hdf5", + "default-features": false, + "features": [ + "parallel" + ] + } + ] + }, + "tests": { + "description": "Build tests" + } + } +} |