From 9dea7a60d6158c2f4b6c5af55c7770e3952b03e3 Mon Sep 17 00:00:00 2001 From: "X.ZhaoMa" Date: Fri, 17 Dec 2021 08:22:33 +0100 Subject: [PATCH] [gmsh] Add new port (#21896) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add: gmsh * add: versioning for gmsh. * [gmsh] Re-factory code * Fix install, remove some features due to lack required dependencies. * version * Do not support uwp officially * version * Update ports/gmsh/portfile.cmake * Update versions/g-/gmsh.json * Group the options * version * version Co-authored-by: JackBoosY Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> --- ports/gmsh/fix-install.patch | 38 ++++++++++++ ports/gmsh/portfile.cmake | 111 +++++++++++++++++++++++++++++++++++ ports/gmsh/vcpkg.json | 46 +++++++++++++++ versions/baseline.json | 4 ++ versions/g-/gmsh.json | 9 +++ 5 files changed, 208 insertions(+) create mode 100644 ports/gmsh/fix-install.patch create mode 100644 ports/gmsh/portfile.cmake create mode 100644 ports/gmsh/vcpkg.json create mode 100644 versions/g-/gmsh.json diff --git a/ports/gmsh/fix-install.patch b/ports/gmsh/fix-install.patch new file mode 100644 index 00000000000000..2f4510240781de --- /dev/null +++ b/ports/gmsh/fix-install.patch @@ -0,0 +1,38 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7040709..a4b8c61 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1872,12 +1872,30 @@ endif() + + # mark targets as optional so we can install them separately if needed + # (e.g. "make lib" or "make shared" followed by "make install/fast") +-install(TARGETS gmsh DESTINATION ${GMSH_BIN} OPTIONAL) ++install( ++ TARGETS gmsh ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ OPTIONAL ++) + if(ENABLE_BUILD_LIB) +- install(TARGETS lib DESTINATION ${GMSH_LIB} OPTIONAL) ++ install( ++ TARGETS lib ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ OPTIONAL ++ ) + endif() + if(ENABLE_BUILD_SHARED OR ENABLE_BUILD_DYNAMIC) +- install(TARGETS shared DESTINATION ${GMSH_LIB} OPTIONAL) ++ install( ++ TARGETS shared ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ OPTIONAL ++ ) + endif() + + if(ENABLE_ONELAB AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/onelab) diff --git a/ports/gmsh/portfile.cmake b/ports/gmsh/portfile.cmake new file mode 100644 index 00000000000000..78f9194a191135 --- /dev/null +++ b/ports/gmsh/portfile.cmake @@ -0,0 +1,111 @@ +vcpkg_from_gitlab( + GITLAB_URL https://gitlab.onelab.info + OUT_SOURCE_PATH SOURCE_PATH + REPO gmsh/gmsh + REF gmsh_4_9_0 + SHA512 e70a09741a86a9131094e77742078aec1cc94517e1d7c855c257bc93c21c057e25c7ac5168d31ec4d905d78f31d5704faf63bfd3a81b4b9e2ebbcfacf2fdaa8b + HEAD_REF master + PATCHES fix-install.patch +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_LIB) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) +string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_RUNTIME) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + opencascade ENABLE_OCC + opencascade ENABLE_OCC_CAF + opencascade ENABLE_OCC_TBB + mpi ENABLE_MPI + zipper ENABLE_ZIPPER +) + + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + DISABLE_PARALLEL_CONFIGURE + OPTIONS + ${FEATURE_OPTIONS} + -DENABLE_BUILD_LIB=${BUILD_LIB} + -DENABLE_BUILD_SHARED=${BUILD_SHARED} + -DENABLE_MSVC_STATIC_RUNTIME=${STATIC_RUNTIME} + -DGMSH_RELEASE=ON + -DENABLE_PACKAGE_STRIP=ON + -DENABLE_SYSTEM_CONTRIB=ON + # Not implement + -DENABLE_GRAPHICS=OFF # Requires mesh, post, plugins and onelab + -DENABLE_POST=OFF + -DENABLE_PLUGINS=OFF + -DENABLE_MESH=OFF + -DENABLE_PARSER=OFF + -DENABLE_PROFILE=OFF + -DENABLE_PRIVATE_API=OFF + -DENABLE_QUADMESHINGTOOLS=OFF + -DENABLE_PRO=OFF + -DENABLE_TOUCHBAR=OFF + -DENABLE_VISUDEV=OFF + -DENABLE_BLAS_LAPACK=OFF + -DENABLE_CAIRO=OFF + -DENABLE_CGNS=OFF + -DENABLE_CGNS_CPEX0045=OFF + -DENABLE_EIGEN=OFF + -DENABLE_GMP=OFF + -DENABLE_OPENMP=OFF + -DENABLE_POPPLER=OFF + -DENABLE_WRAP_JAVA=OFF + -DENABLE_WRAP_PYTHON=OFF + # Requies dependencies which not included in vcpkg yet + -DENABLE_3M=OFF + -DENABLE_ALGLIB=OFF + -DENABLE_ANN=OFF + -DENABLE_BAMG=OFF + -DENABLE_BLOSSOM=OFF + -DENABLE_BUILD_DYNAMIC=OFF # Needs gfortran + -DENABLE_FLTK=OFF # Needs executable fltk-config + -DENABLE_DINTEGRATION=OFF + -DENABLE_GEOMETRYCENTRAL=OFF + -DENABLE_DOMHEX=OFF + -DENABLE_GETDP=OFF + -DENABLE_GMM=OFF + -DENABLE_HXT=OFF + -DENABLE_KBIPACK=OFF + -DENABLE_MATHEX=OFF + -DENABLE_MED=OFF + -DENABLE_METIS=OFF + -DENABLE_MMG=OFF + -DENABLE_MPEG_ENCODE=OFF + -DENABLE_MUMPS=OFF + -DENABLE_NUMPY=OFF + -DENABLE_NETGEN=OFF + -DENABLE_PETSC4PY=OFF + -DENABLE_ONELAB_METAMODEL=OFF + -DENABLE_ONELAB=OFF + -DENABLE_OPENACC=OFF + -DENABLE_OPTHOM=OFF + -DENABLE_OSMESA=OFF + -DENABLE_P4EST=OFF + -DENABLE_PETSC=OFF + -DENABLE_QUADTRI=OFF + -DENABLE_REVOROPT=OFF + -DENABLE_SLEPC=OFF + -DENABLE_SOLVER=OFF + -DENABLE_TCMALLOC=OFF + -DENABLE_VOROPP=OFF + -DENABLE_WINSLOWUNTANGLER=OFF + # experimental + -DENABLE_BUILD_ANDROID=OFF + -DENABLE_BUILD_IOS=OFF + + -DENABLE_OS_SPECIFIC_INSTALL=OFF # Needs system permission + -DENABLE_RPATH=OFF # Should use dependencies in vcpkg + -DENABLE_TESTS=OFF +) + +vcpkg_cmake_install() + +vcpkg_copy_tools(TOOL_NAMES gmsh AUTO_CLEAN) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") + +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/gmsh/vcpkg.json b/ports/gmsh/vcpkg.json new file mode 100644 index 00000000000000..70b1d266ec9cec --- /dev/null +++ b/ports/gmsh/vcpkg.json @@ -0,0 +1,46 @@ +{ + "name": "gmsh", + "version": "4.9.0", + "description": "Gmsh is an open source 3D finite element mesh generator with a built-in CAD engine and post-processor.", + "homepage": "https://gmsh.info", + "supports": "!uwp", + "dependencies": [ + "blas", + { + "name": "vcpkg-cmake", + "host": true + } + ], + "features": { + "graphics": { + "description": "Enable building graphics lib even without GUI (advanced)", + "dependencies": [ + "libjpeg-turbo", + "libpng", + "opengl", + "zlib" + ] + }, + "mpi": { + "description": "Enable MPI (experimental, not used for meshing)", + "dependencies": [ + "openmpi" + ] + }, + "occ": { + "description": "Enable OpenCASCADE modules", + "dependencies": [ + "caf", + "freetype", + "opencascade", + "tbb" + ] + }, + "zipper": { + "description": "Enable Zip file compression/decompression", + "dependencies": [ + "zlib" + ] + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index 6e37e821c8dc59..b14398e28f6d0f 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2516,6 +2516,10 @@ "baseline": "6.2.1", "port-version": 7 }, + "gmsh": { + "baseline": "4.9.0", + "port-version": 0 + }, "google-cloud-cpp": { "baseline": "1.34.1", "port-version": 0 diff --git a/versions/g-/gmsh.json b/versions/g-/gmsh.json new file mode 100644 index 00000000000000..1b357c663e8528 --- /dev/null +++ b/versions/g-/gmsh.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "d01377e2003c3ea5ef7a6b9fb215a086e5f75eed", + "version": "4.9.0", + "port-version": 0 + } + ] +}